Time.timeScale

how do you measure frame time when timeScale is 0 / for animated UI when game is paused

thanks! :smile:

It’s not as robust as Time.deltaTime, but you could record the value of Time.time at the start of each frame and subtract the value from the previous frame to get the inter-frame time.

ok-for some reason i was thinking Time.time was affected by Time.timeScale.

Thanks!
:smile:

A simple hack is to use something like .0001 for the timeScale instead of 0. Unless you are concerned about players leaving the game paused for several thousand years only to discover things have moved slightly upon resuming, it works just as well, and you can continue to use deltaTime as usual.

–Eric

Nice!

I like the .00001 hack, because we all know that an iPhone battery lasts only .001 seconds :slight_smile:

I used Time.realtimeSinceStartup.

I’m not sure I understand the .0001 hack. Doesn’t timeScale still affect Time.deltaTIme?

Thanks

Paul

Yes, but you just use timeScale in movement calculations as well (see here for an example).

–Eric