Attached to my player i have a pause menu script wich looks like this
var paused : boolean = false;
var myCheck : boolean = false;
function Update () {
if(Input.GetButtonDown( “Pause” ) ) {
if(!paused) {
Time.timeScale = 0;
paused = true;
}else{
Time.timeScale = 1;
paused = false;
}
}
}
function OnGUI() {
if( paused ) {
if(GUI.Button (Rect ( 10, 50, 100, 30), “Resume” )) {
Time.timeScale = 1.0F;
paused = false;
}
if(GUI.Button (Rect ( 10, 90, 100, 30), "Restart" )) {
Application.LoadLevel( "stage1" );
}
if(GUI.Button (Rect ( 10, 130, 100, 30), "Options" )) {
}
if(GUI.Button (Rect ( 10, 170, 100, 30), "Quit" )) {
}
}
}
it is functional and appear/disappear upon pressing the pause button (P) but the problem is, when i press the “test game” button in unity, the game starts with the pause menu showing on screen. i can move around like normal but the pause buttons are still showing on screen and they are functional when pressed. if i press the pause button (P) the menu goes away until i either reload the mission by dying or press the pause button. can i get a version of this script where this problem is not present?