Game Development Reference
In-Depth Information
backgroundColor : This is the global background color tint.
depth : This is the depth order for the current GUI script. This is useful if you
have GUI elements in more than one script and want to layer them.
matrix : The 3D transformation matrix for the current GUI.
All of these elements can be used to override all controls or individual controls by
setting them in between controls.
Layout controls
If you prefer not to hand draw the position of every single control in your GUI,
Unity does offer some automatic layout controls from the GUILayout class.
The Layout controls (using GUILayout instead of just GUI) have the same set of
controls as the normal GUI class (hence I'm not going to describe them all over
again), the main difference is that you do not need to specify a Rect area to draw
the control, as it will just be drawn at the first suitable location; any further controls
added will be laid out appropriately with enough spacing between the controls.
You can also control the spacing and even if you want, any empty space between the
controls using the Width , Height , and Spacing properties (Space/FlexibleSpace) of
GUILayout , following the same rules as for GUI controls (setting up the GUILayout
before drawing a control).
If you don't want the layout to take up the maximum space for a control,
you also have the settings for Width (MaxWidth/MinWidth) and Height
(MaxHeight/MinHeight).
The main differences are as follows:
• BeginGroup becomes BeginArea
• Horizontal and vertical groups (sub groups)
BeginArea
Instead of defining Groups , you define Areas . Apart from the name, they behave
exactly the same. This is the only layout control that takes a Rect parameter to
specify where you want to draw the controls (excluding Windows of course); all
GUILayout controls are then aligned to Area in the same way they are in Group .
It's recommended that when using GUILayout controls that you
place them in an Area for the best effect.
 
Search WWH ::




Custom Search