- Home /
Time.timeScale = 0; freezes my game for a few seconds.
Hello community,
I recently implemented a pause menu, and obviously, has a Time.timeScale = 0 function to pause it, and = 1 to play it again, but a strange behaviour is happening on the first pause, it happens that in the first time i pause, everything pause and works just fine, but when i resume my game and set my Time.timeScale = 1 again, my unity freezes for 3 ou 4 seconds before it unpauses the game, just for the first time, the other times works fine, so this behaviour is pretty strange, i don't know how to fix it.
And my script is pretty simple, just a regular:
if(pause) {
Time.timeScale = 0;
} else {
Time.timeScale = 1;
}
Anyone knows how to fix this annoying problem? Thank you very much.
Answer by jpthek9 · Jan 03, 2015 at 05:29 PM
This might be a bug. Try submitting it to Unity's bug catchers. For a quick fix, just pause at the very start of the game.
Set the default timescale to 0 and have this in one of your scripts.
void Start()
{
Time.timeScale = 1;
}
Hope it's not a bug, if so, there isn't much to do. unfortunately; Thanks for your quick answer jpthek9.
Your answer
Follow this Question
Related Questions
How to get a smoother slow motion 0 Answers
text and image prefab not popping up when set.active 2 Answers
Trouble with Time.Timescale 2 Answers
Use UI buttons with Time.timeScale=0? 3 Answers
Pause menu 1 Answer