First, make a statement:
1, this is a wild way non-training small rookie of the study, so sincerely welcome criticism (and the content may be wrong);
2, I currently use the Unity3d version is 5.3.5;
Anyway
In fact, it's very rare to create UI controls with the GUI in the development process! (since Unity4.6 began, unity has its own visual Ugui)
However, as a companion to Unity for so many years, but also for the occasional "system learning" These four words, the rookie decided to spend 2--3 a space to
A little recap of the knowledge points about the GUI. gossip Less, on dry goods!!
1. Create button (single):
In the Void Ongui () method:
Gui. button (new Rect (SCREEN.WIDTH/10,SCREEN.HEIGHT/2,SCREEN.WIDTH/5,SCREEN.HEIGHT/10), "button");//position, size, content (you can also set the style);
Draw a button from the layout manager: Guilayout.button (New Guicontent ("Play Game", "Button1"));
2. Create a Label:
In the Void Ongui () method:
Gui. Label (New Rect (SCREEN.WIDTH/10, SCREEN.HEIGHT/10, SCREEN.WIDTH/5, SCREEN.HEIGHT/10), "Hellow world!"); /location, size, content (you can also set style);
3, create box, TextField, Toggle (switch (BOOL)) are similar;
/*************************************************************/************************************************ *****/
skin/color/tooltip/changed/backgroundcolor/contentcolor/enabled/depth:
These are the variables of the graphical user component that are used to set up the graphical UI components as a whole
4. Set the background color, component color, and text color in the component (composited with component color) in void Ongui () method
The methods were: Gui.backgroundcolor = Color.yellow; Gui.color = Color.green;
Gui.contentcolor = color.red;
5, there are other methods (time can be specifically checked)
Changed/enabled (all bool types).
Gui.changed: Used to detect whether the data of my input control has changed;
Gui.enabled: Used to control and determine the activation of the graphical user interface (only for the controls underneath the statement).
6. ToolTip Usage (cue box variable) Example:
Draw a button named Click me and set the prompt message for this is the ToolTip;
Gui. button (new Rect (SCREEN.WIDTH/2, SCREEN.HEIGHT/10, SCREEN.WIDTH/5, SCREEN.HEIGHT/10), New Guicontent ("Click Me", "T He is the Tooltip "));
Draw a label lable and assign the hint message "This is the ToolTip" to the label
Gui. Label (New Rect (SCREEN.WIDTH/2, SCREEN.HEIGHT/5, SCREEN.WIDTH/5, SCREEN.HEIGHT/10), Gui.tooltip);
7. Depth variable
The behavior of sorting the controls in the current graphical user interface in depth;
All right! As a result of the actual development has been rarely used, so the GUI-related knowledge of a rough mention, interested in small partners can private messages to me, specific study together!
"Welcome to Reprint"
Reprint please indicate source: le study
GUI create each common control (i)