x


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?

more ▼

asked Jun 19 '10 at 10:15 AM

qJake gravatar image

qJake
11.6k 43 78 161

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

You could grab your own delta time storing Time.realTimeSinceStartup and use that, should work well enough

more ▼

answered Jun 19 '10 at 10:50 AM

Mike 3 gravatar image

Mike 3
30.5k 10 65 252

Sounds messy, but doable. Let's see if anyone comes up with a cleaner solution. ;)

Jun 19 '10 at 11:14 AM qJake

Wouldn't be too messy if you encapsulated it in a coroutine, and lerped there

Jun 19 '10 at 11:48 AM Mike 3

Came in to post exactly this. Its what I would do. +1

Jun 19 '10 at 01:44 PM dhendrix

Turns out this works, and yeah, it might be better encapsulated as an individual class.

Jun 20 '10 at 06:47 PM qJake
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3769
x261
x83

asked: Jun 19 '10 at 10:15 AM

Seen: 1585 times

Last Updated: Jun 19 '10 at 10:15 AM