- Home /
Question by
RuinedUnknown · Aug 18, 2011 at 04:16 AM ·
javascriptguifor-loopguilayoutlabel
For Loop GUILayout.Label Problems
Note: Using Javascript
Hi, I've Tried Searching For Other People That Are Having This Same Problem And Couldn't Find Anything, So I Decided To Post This Question To See If Anyone Could Help.
Code:
var StringArray : String[] = ["Hi", "Bye"];
function OnGUI()
{
for(var i : int = 0; i < StringArray.length; i++)
{
//So I Could See If The For Loop Was Going Through And It Wasn't
Debug.Log("i Value: "+i);
GUILayout.Label(StringArray[i]);
}
}
It Doesn't Display The Label And Nothing Goes Through Please Help, Thanks
Comment
Answer by gribbly · Aug 18, 2011 at 08:38 AM
Are you certain that your script is attached to an object in the scene?
If it is, try:
function OnGUI(){
Debug.Log("OnGUI");
//the rest of the function...
}
...so you can be sure that you're getting OnGUI events.
If you are, the problem is in your loop (which looks OK to me).
Your answer
![](https://koobas.hobune.stream/wayback/20220612183356im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Open gui if player clicks on button 2 Answers
[Solved]Label is not a member of GUI anymore. 1 Answer
GUILabel doesn't show up 1 Answer
Why does old text in GUILayout not disappear? 1 Answer
Fade out GUILayout Area? 1 Answer