Game Development Reference
In-Depth Information
GUILayout.BeginHorizontal();
GUILayout.Button(itemCount[6].Value.ToString()
+ " " + invItems[6].name, GUILayout.Height(75));
GUILayout.Button(itemCount[7].Value.ToString()
+ " " + invItems[7].name, GUILayout.Height(75));
GUILayout.Button(itemCount[8].Value.ToString()
+ " " + invItems[8].name, GUILayout.Height(75));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Button(QuickItems[0].name,
GUILayout.Height(50));
GUILayout.Button(QuickItems[1].name,
GUILayout.Height(50));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Button(QuickItems[2].name,
GUILayout.Height(50));
GUILayout.Button(QuickItems[3].name,
GUILayout.Height(50));
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
To start off, we access GUILayout and use BeginArea . This is a useful tool to have
a contained area to work with. The next step is to activate the BeginHorizontal
function within GUILayout , which ensures that everything we put on the GUI is in
an even, horizontal line. After this, we create GUILayout buttons, one for each slot
in our inventory. We set the text of the button to the amount and name of an item
within the inventory, then we set the height of the button.
Search WWH ::




Custom Search