1
void OnGUI() { if (GUI.Button(new Rect(-36, 79, 83, 31), "Play")) { Application.LoadLevel(1); } } 

This code does exactly what I want it to do, make the 'play' button, bring me to scene 1 (starting out from the main menu, scene 0) BUT, for some reason (I am new to coding, may have did something wrong, obviously) it makes a new play button and applies it to that button (idk how it does that xD I wasn't even trying to make it make a new button) but anyways, I want it to apply to the already existing play button that I added.

1

1 Answer 1

1

Are you saying you want the button to go away after it is clicked? To do that you could do something like:

private bool levelLoaded = false; void OnGUI() { if (!levelLoaded && GUI.Button(new Rect(-36, 79, 83, 31), "Play")) { Application.LoadLevel(1); levelLoaded = true; } } 

Clicking the button would set levelLoaded to true. If levelLoaded is true, the script will never reach the part where it draws the button again.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.