Make UI not be affected by timescale?

I have an in-game pause menu that uses buttons and sliders and setting Timescale=0 will stop them from functioning. I’ve read around and haven’t found anything comparable to my problem. Is there any way to make the UI ignore timescale completely?

(This is the new uGUI not legacy)

I think that so long as your components are looking at the Time object, then they will be affected by any changes you make to the time scale. If you want objects to ignore that, or that operate according to a different time scale, you might want to look at encapsulating the unity time service in your own wrapper. this way you could feed out multiple versions of timeDelta to multiple objects.

Incidentally, this is one manifestation of why people hate static methods (not that anybody was asking!! But I think these things are good to record somewhere :). If Unity’s Time methods were implemented as instantiatiable objects, you could just build a new time object for your UI and another time object for the rest of your game.

I suspected as much :frowning: thank you for the information.

1 Like

That’s odd, my UI works perfectly at timescale = 0. If you’re using Animators for them make sure to set the type to Unscaled Time

And if you’re doing something related to time in your UI code just make sure to use Time.unscaledDeltaTime instead of Time.deltaTime.

13 Likes

absolute Gold ensiferum888! Thanks man!

Life saver !

Thank you so much!!