- Home /
GUI box problem
So I'm looking at GUI Basics It says if I use this code:
/* Example level loader */
function OnGUI () {
// Make a background box
GUI.Box (Rect (10,10,100,90), "Loader Menu");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
Application.LoadLevel (1);
}
// Make the second button.
if (GUI.Button (Rect (20,70,80,20), "Level 2")) {
Application.LoadLevel (2);
}
}
That it would do what it shows in the picture. So i copied and pasted, and the i tryed to attach the script to my player, I got an error message saying I can't add it because I haven't fixed all the complier errors. So the compiler errors are saying that 'Box' and 'Button' are not members of GUI. Is there just a problem with my Unity? or do I have to install this?
Never$$anonymous$$d, Problem is I also named the script GUI. Can't do that. $$anonymous$$esses with everything XD I'm leaving the question up for anyone else who has the problem
Answer your question and accept your own answer. This way it's gonna be more readily available for others to see.
Answer by Eli-Davis · Jun 02, 2011 at 08:24 PM
Nevermind, Problem is I also named the script GUI. Can't do that. Messes with everything XD I'm leaving the question up for anyone else who has the problem
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
dropdown menu error 1 Answer
Remove Items and Item Tooltips 0 Answers
GUILabel doesn't show up 1 Answer
WorldToScreenPoint returns the same value when facing the opposite direction. 0 Answers