- Home /
how to arrange numbers
hi i have some bools named "quest1" , "quest2" , "quest3" &... and they may become true or false during the game... I have a ActiveQuests that shows the number of quests that are true... plus them I have a quest1number , quest2number , quest3number &... that are related to quests... I want to arrang the number by the distance of 60... I mean if the active quests are 2 , and the active ones are Quest1 & Quest3 , make quest1number = 60 & quest3number = 160 .... how should I arrange these number? thnx
do you want to arrange them on GUI or something? i dont get your question
You probably want to rewrite your question. I don't get it either.
Yeah... sorry for the question... I make them a GUI label... when "quest1" is true , the GUI label will show up ... and the "quest1number" is the height of the label in GUI... I wrote a code to count that how many quests are true ... then I want now to arrange them... if the quest 1 and 3 are true ... make the height of first one(quest1) 60 and the second one (quest3)160 ... etc.
Answer by Berenger · Feb 03, 2012 at 04:26 PM
According to your comment, you want to pile down several GUI.Label. Once you know which one you'll display, you can use either GUILayout, which by default is Vertical so it does exactly that, or use a loop and your y will be yStart + increment*offset.
so I made a script and it will see that which quest is true... for example 2 & 3 ... so I want this part =>> "make 'quest2number(height)'=60 & 'quest3number(height)'=120..." how should I set this exact part? (can u give me the code or explain the exact thing?)
The point of GUILayout is that you don't specify the height of each element, Unity organize it according to the specification you give it (or the default value if you don't, in your case the defaults ones are ok). Check out that page, everything is in there : http://unity3d.com/support/documentation/ScriptReference/GUILayout.Label.html
this work great... but how can I set the size or X of the labels and button in GUIlayout??
thnx I got it... I used GUILayout.Height() & Width & BeginArea
Your answer
Follow this Question
Related Questions
bool to int? (false = 0, true = 1) Conversion possible? Or manually set int to 0/1? 2 Answers
how to i increase a number temporally 1 Answer
Accessing quadrant/joystick number when using multiple xbox 360 controllers 1 Answer
Why aren't these numbers going down by 1. 1 Answer
Limit number of bullet on screen c# 1 Answer