Thursday, December 4, 2014

Unity: Horizontal Flow Layout

The following code snippet uses the GUILayout to conveniently make a horizontal flow layout that contains 10 labels.

void OnGUI()
{
  GUILayout.BeginArea(new Rect(0, 0, Screen.width / 4, 32));
  GUILayout.BeginHorizontal();

  for(int i=0; i < 10; ++i)
  {
 GUILayout.Label(i.ToString());
  }

  GUILayout.EndHorizontal();
  GUILayout.EndArea();
}


No comments:

Post a Comment