- Home /
Time-independent lerping of Time.timeScale
I have a predicament. I want to "animate" Time.timeScale
, but I want it to be framerate-independent. In my particular instance, I want it to count from 0 to 1, or 1 to 0, over a set amount of time. I obviously can't use Time.deltaTime
or anything like that, since those are dependent on the time scale. And I can't just subtract it, because then it becomes non-framerate-independent, so it's either really slow in the editor, or really fast in builds.
So... how can I create an effective "Time Scale Lerp" that is framerate-independent?
Answer by Mike 3 · Jun 19, 2010 at 10:50 AM
You could grab your own delta time storing Time.realTimeSinceStartup and use that, should work well enough
Sounds messy, but doable. Let's see if anyone comes up with a cleaner solution. ;)
Wouldn't be too messy if you encapsulated it in a coroutine, and lerped there
Turns out this works, and yeah, it might be better encapsulated as an individual class.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062451im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Material transition through animation 3 Answers
mecanim animation while timescale is zero 1 Answer
Control animation speed with slider 4 Answers