- Home /
List array in GUI.Box
Hey Guys, this is just some sample code, basically it draws a box on screen and lists Apple at the top, var stock = new Array("Apple","Orange","Banana"); var item1 = stock[0]; var item2 = stock[1]; var item3 = stock[2];
function Start ()
{
}
function Update ()
{
}
function OnGUI()
{
GUI.Box(Rect(10,10,200,200),stock[0]);
}
What I would like to know now is how do I make it list all the items, this is probably very simple but I have stuck for about 30 mins now.
Please help!
Peace
Comment
well, half way there, i update the slightly,
function OnGUI()
{
for(i = 0; i < stock.length-1; i++)
{
GUI.Box(Rect(10,10,200,200),stock[i]);
}
}
Which kinda works, but now all the text is written on top of eachother.