- Home /
Pause game but not Canvas and some effect
Hello, Im trying to pause my game but i dont know how to start. The game is an FPS, and I want to pause the enemies, their shoots, and of course player movement BUT I dont want to pause the canvas, so you can use the menus, but, when you open the canvas there is your character with an idle animation, and i dont want to pause it, and the canvas has some effects too in the sprite (with materials/shaders)
How can i aboard this? THX
Answer by betaFlux · Jan 01, 2019 at 12:45 PM
To pause the game you usually set Time.timeScale to 0 or if errors arise to a rediculously small value.
Unity's UI is not affected by Time.timeScale. So, buttons, toggles, etc. all still work as you'd expect.
If you want to keep things moving that run multiplied by Time.deltaTime then it's just a matter of replacing it with a custom deltaTime as described at the bottom of this post.
As for animations; anything animator-controlled can be released from timeScale by adding animator.updateMode = AnimatorUpdateMode.UnscaledTime;
to your initializing function.
Your answer
Follow this Question
Related Questions
Setting timeScale to 0 causing editor to freeze 0 Answers
Making a pause menu resume 2 Answers
Buttons will not change color 11 Answers
How to Disable Boxcollider2d when game is paused. 2 Answers
Game stays paused after Restart. 1 Answer