September 2010
Beginner
384 pages
8h 49m
English
By dropping two more instances of FlexibleSpace into your BuildGrid() function, you can horizontally center the grid on the screen.
GUILayout.FlexibleSpace(); function call between the GUILayout.BeginHorizontal() and GUILayout.EndHorizontal() calls:function BuildGrid()
{
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
for(i=0; i<rows; i++)
{
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
for(j=0; j<cols; j++)
{
// Again, the code here has been removed for the sake of brevity
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
}
Read now
Unlock full access