So, I have a button in main menu with this code
var soundhover : AudioClip;
var beep : AudioClip;
var QuitButton : boolean = false;
function OnMouseEnter(){
audio.PlayOneShot(soundhover);
} function OnMouseUp(){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
if(QuitButton){
Application.Quit();
}
else{
Application.LoadLevel("tanktes");
}
} @script RequireComponent(AudioSource);
I can do the LoadLevel alright for the first time. And then I pause Ingame and go back to main menu by clicking a code. Here’s the pause code :
if(Input.GetButtonUp("Esc"))
{
doWindow0 = true;
Screen.lockCursor = false;
Screen.showCursor = true;
Time.timeScale = 0;
}
And here’s the Back to menu button code:
if(GUI.Button (Rect (10,30, 150,20), "Back to Menu"))
Application.LoadLevel("StartMenu");
And I can go back to the main menu. But this time, the play game button AND the quit button are not working (tested it on the .exe file). The audio when the mouse is hovering plays fine so we can assume the script is working, but it’s not going back to the game scene. What seems to be the cause of this? Helps appreciated.