When i pause the game there is an option to quit.
But if restart the game without refreshing it, it stays paused and you have to press p before being able to play.
here's my script:
static var timeScale : float =1.0;
// Toggles the time scale between 1 and 0.7
// whenever the user hits the Fire1 button.
var Ispaused : boolean =false;
function Update () {
if (Input.GetKeyDown ("p")) {
if (Time.timeScale == 1.0) {
Time.timeScale = 0;
Ispaused=true;
}
else {
Time.timeScale = 1.0;
Ispaused=false;
}
Time.fixedDeltaTime = 0.02 * Time.timeScale;
}
}
function OnGUI () {
if(Ispaused){
// Make a background box
GUI.Box (Rect (200,200,100,90), "Pause Menu");
if (GUI.Button (Rect (200,220,80,20), "Quit")) {
Application.LoadLevel (0);
Ispaused=false;
}
}
}
i tried putting Ispaused=false at the end when reloading but it didn't help =|. How do i fix this?
thanks! :D