The guilayout layout can automatically arrange related controls, for example:
1 void ongui () 2 {3 guilayout. Button ("This guilayout button"); 4}
Effect:
The widget size can be automatically scaled to fit the size, arranged from the upper left corner of the screen, for example:
1 void ongui () 2 {3 guilayout. Button ("This Is A guilayout button"); 4 guilayout. Button ("this is also a guilayout button"); 5}
Effect:
The default value is vertical arrangement and the horizontal arrangement can be displayed, for example:
1 public float hslidervalue = 0.0f; 2 3 void ongui () 4 {5 guilayout. beginhorizontal (); 6 7 guilayout. button ("This Is A guilayout button"); 8 9 hslidervalue = guilayout. horizontalslider (hslidervalue, 0.0f, 100366f, guilayout. width (100); 10 11 guilayout. endhorizontal (); 12 13}
Effect:
You can also add gaps between controls:
1 public float hslidervalue = 0.0f; 2 3 void ongui () 4 {5 guilayout. beginhorizontal (); 6 7 guilayout. button ("This Is A guilayout button"); 8 9 guilayout. space (20); 10 11 hslidervalue = guilayout. horizontalslider (hslidervalue, 0.0f, 100366f, guilayout. width (100); 12 13 guilayout. endhorizontal (); 14}
Effect:
C # compile the guilayout control of the basic GUI of Unity