- Home /
Found a solution
GUI Array Help
Hi there!
I need some help with a pickup script I'm working on.
It's pretty simple right now. I have another script where I pickup an item. This script is the inventory and It shows a text what you've picked up. I have it so the text stacks beside of each other, but the problem I have is that it stacks on the x position. I want it to stack on the y. So I want it to be in the left bottom corner (as it is), and the text stacking goes up and up.
I'm new to all this with arrays and stuff so don't be to hard on me ;)
var batteries = new Array();
function OnGUI()
{
for(var i : int = 0; i < batteries.length; i++)
{
GUI.Label(new Rect((90 + (i*60)), Screen.height - 60, 120, 50), "Picked up Battery");
}
}
Answer by zharik86 · Sep 12, 2014 at 10:13 PM
If you want to change simply location of your GUI elements, you see a code below:
function OnGUI() {
for(var i : int = 0; i < batteries.length; i++) {
//From left bottom corner
GUI.Label(new Rect((0, Screen.height - 50*(i+1), 120, 50), "Picked up Battery");
}
}
I hope that it will help you
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
GUI will not disappear 1 Answer
Score Help (Im new) 1 Answer
c# add/move lines of text in GUI box 1 Answer
c# Quit button wont quit game 1 Answer