Hello i have a javascript where i can pause my game but it seems not to work, i can unpause but not pause again. If you can tell what the problem is throught the script then tell me thanks (:
#pragma strict
var isPaused : boolean = false;
function Update ()
{
//Pause
if(Input.GetKeyDown(KeyCode.P) && isPaused == false)
{
isPaused = true;
}
//UnPause
if(Input.GetKeyDown(KeyCode.P) && isPaused == true)
{
isPaused = false;
}
//Pause
if(isPaused == true)
{
Time.timeScale = 0.0;
}
if(isPaused == false)
{
Time.timeScale = 1.0;
}
}