# Unity skips menu screen and goes to next scene

I am using Unity 4.6.1 and I am working on a game project. I created a JS script with Application.LoadLevel to go to the next scene. Here is my code for OnGUI:

function OnGUI () {

{

}

}

When I tested the game the first time, everything worked fine, but the second time, it shows the menu for a few seconds and goes directly to the first level. I did the same thing with another scene and another JS script then changed my build settings to see if that would help. It did the same thing like the first JS script. How can I fix this so that the level loads then the player presses a button instead of it loading immediately?

• So, you don't want "Level1" to be loaded immediately? If so, you'll need to add some code to control when Application.LoadLevel() is called. Right now it's being called in the first frame that this object is enabled (because that's when OnGUI() happens). You'll need to clarify in your question when you want the level to be loaded instead - eg. after a delay, or only when the player presses a particular button, etc. – DMGregory Apr 6 '15 at 23:00
• I edited the question at the end. – kprovost7314 Apr 6 '15 at 23:09

void OnGUI() {