- Home /
Game wont Unpause (Using Time.timeScale)
i'm a beginner take it easy on me . So the debug.log works once and never again , I mean the console Display : Paused 2 , unpaused 1 and it stays like that forever ... I tried adding a debug.log("Not working") in the FixedUpdate and it never displays after pausing the game .. One more question does the scripts freez by freezing time ? thx in advance . This is my code :
void PauseGame(){
if(Input.GetKeyDown(KeyCode.P))
{
GamePaused = !GamePaused;
if (GamePaused) {
Time.timeScale = 0.0f;
Debug.Log ("Paused");
} else {
Debug.Log ("UnPaused");
Time.timeScale = 1.0f;
}
}
}
}
Answer by kog513 · Jul 15, 2018 at 12:58 PM
for anyway one having the same problem , I used my pausegame method in the Update function instead of FixedUpdate , and it works now , I think FixedUpdate works only if time scale is higher than 0 .. dont know will do more research about it .. thx anyway
In general you should only use FixedUpdate for physics calculations, you can savely use update for any other game mechanic.
Yes I read about it , thanks mate ! , so lets suppose I wanted to add some slowing time effect or ability lets say , I mean like in prince of persia or other games .. $$anonymous$$y player's behaviors should all be physics indepandent and I should call them in Update() methode right ?