Heya,
I’m trying to arrange two rows of GUI.Boxes, the boxes are created from a single array but i want the boxes to appear on two lines. I’ve tried the below code and this works but obviously the first line lists ALL the array when i want it to only list the first 4.
for(i = 0; i < Slots.length; i++)
{
GUI.Box (Rect ((InventorywindowRect.width / InventorywindowRect.width) + (i * 40) + 10, 20, 40, 40), Slots[i].ToString());
}
for(i = 5; i < Slots.length; i++)
{
GUI.Box (Rect ((InventorywindowRect.width / InventorywindowRect.width) + ((i - 5) * 40) + 10, 20, 40, 40), Slots[i].ToString());
}
elp!
ackyth
October 8, 2010, 7:32pm
2
anon_52083652:
Heya,
I’m trying to arrange two rows of GUI.Boxes, the boxes are created from a single array but i want the boxes to appear on two lines. I’ve tried the below code and this works but obviously the first line lists ALL the array when i want it to only list the first 4.
for(i = 0; i < Slots.length; i++)
{
GUI.Box (Rect ((InventorywindowRect.width / InventorywindowRect.width) + (i * 40) + 10, 20, 40, 40), Slots[i].ToString());
}
for(i = 5; i < Slots.length; i++)
{
GUI.Box (Rect ((InventorywindowRect.width / InventorywindowRect.width) + ((i - 5) * 40) + 10, 20, 40, 40), Slots[i].ToString());
}
elp!
Change
for(i = 0; i < Slots.length ; i++)
to 5
or you can use
if (i > 4)
break;
in the for 1st forloop.