Time for action - create an area to store the grid
Let's create one of these Automatic Layout areas in our GameScript.
- We don't need the
Update
function in this script either. As we did earlier, changeUpdate
toOnGUI
to create anOnGUI
function:function OnGUI () {
- Begin and end the Automatic Layout area inside the
OnGUI
function:function OnGUI () { GUILayout.BeginArea (Rect (0,0,Screen.width,Screen.height)); GUILayout.EndArea(); }
The area will be the width and height of the screen, and it will start at the screen origin at the top-left of the screen.
These two statements are like bookends or HTML tags. Any UI controls we build between these bookends will be created within the area. Each new control will automatically stack vertically beneath ...
Get Unity 3D Game Development by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.