Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

Probal Das
Probal Das
13,834 Points

Making animations work in Unity even after setting timescale = 0

I am currently working on a game in which I have used animations for the UI elements. These are simple animations like zoom in and out. I haven't used any animator component. instead used animation component and trigger my animations using scripts. Now when I pause my game by using Time.timescale = 0, my animations are not working. I know in animator component I can control this using updateMode. But since I am not using animator component, I am looking for an alternate way to make my animations work even in zero timescale. Please help!!!

1 Answer

I'm still trying to wrap my head around some of the basics myself, but I think you should check out either AnimatorUpdateMode.UnscaledTime (usually used for GUI animation when timescale = 0), or Time.unscaledTime (or .unscaledDeltaTime). There might be better ways, but you should be headed in the right direction if you read up on those and some of their variations.