Problem with a pause menu with animations

[EDIT: The issue is resolved, the solution was changing the “Update Mode” field of the animator component to “Unscaled Time” instead of “Normal”.]

Hello there,

First of all, I hope I am posting this thread to the relevant forum. I thought about posting it to the animations forum but my issue is not specifically about the animations themselves.

I have created a pause menu to my game which exists in a separate scene that is being loaded on Awake to the game scene using LoadSceneMode.Additive.
In my pause menu I have four buttons, that I’ve added a simple animation to them which causes them to become bigger and then back to their normal size when a button is selected. The problem is that animation is getting stuck on the first frame, and after checking what causes this issue, I found out that it happens because I am setting Time.timeScale to 0 when pausing (when I commented this line the animations worked properly, but obviously the game was no longer paused).

Is there a way to change Time.timeScale only on my game scene while not affecting additive scenes, so it actually pauses without preventing the animations in other scenes from playing (which would be ideal if this solution is possible)? If not, what else could I possibly do to solve this issue while making sure the game is indeed paused?

Many thanks in advance to anyone who’ll try to help, and have a great day!

How are you doing your animation? If it’s a custom script you wrote, just use Time.unscaledTime and Time.unscaledDeltaTime in that script.

I’m using the animator. I’ve just read an article about pausing a game in unity and managed to fix my problem, the solution was changing the “Update Mode” field of the animator component to “Unscaled Time” instead of “Normal”.

Thanks a lot PraetorBlue!

2 Likes

I didn’t get that , Do you mean instead of using time.timeScale = 0 To stop the game i should use time.UnscaledTime = 0 ?

No.

Time.unscaledTime is a replacement for Time.time.

Time.unscaledDeltaTime is a replacement for Time.deltaTime.