- Home /
GUI is not showing up, but script seems to be fine
Hi!
I made this simple GUI script based on some tutorials, and after applying it to empty game object and pushing play, GUI won't show up. Any ideas?
private var buttonWidth:int = 200; private var buttonHeight:int = 50; var spacing:int = 25;
function OnGUI()
{
GUILayout.BeginArea(Rect(Screen.width/2 - buttonWidth/2, Screen.height/2 - 200, buttonWidth, - 400));
if(GUILayout.Button("New Game", GUILayout.Height(buttonHeight)))
{
Application.LoadLevel("Game");
}
GUILayout.Space(spacing);
if(GUILayout.Button("Continue", GUILayout.Height(buttonHeight)))
{
Application.LoadLevel("testcontinue");
}
GUILayout.Space(spacing);
if(GUILayout.Button("Exit", GUILayout.Height(buttonHeight)))
{
Application.Quit();
}
GUILayout.EndArea();
}
Comment
Best Answer
Answer by robertbu · Apr 01, 2013 at 01:31 PM
For the last parameter in your GUILayout.BeginArea() you are specifying a negative value (-400). Change it to 400.
Thanks! $$anonymous$$oderator, please close the question.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How To Make GUI Buttons Load/Quit 1 Answer
GuiTexture Width Change 1 Answer
How to save and load text in a GUI TextArea 1 Answer
Help Changing GUI Text size 0 Answers