Time.currentDeltaTime

Should we have Time.currentDeltaTime

Would return Time.deltaTime or Time.fixedDeltaTime depending if we are running it in physics loop or renderer loop.

This is how Time.deltaTime already works.

4 Likes

Yes, during the time where all FixedUpdate methods are called, Time.deltaTime will already return Time.fixedDeltaTime.

1 Like

No s**t was I so wrong for so many years ?
Was it like this from the beginning ?

How can I obtain Update() kind of deltaTime in FixedUpdate ?

I guess this was like that from the beginning, otherwise it would be quite big change which big companies can’t afford, because of compatibility and legacy code.

You can simply save Time.deltaTime into a field in Update. But I can’t expect the case when it’s even useful.

1 Like

At minimum it has been this way for a very long time. The farthest back the official docs go seems to be 3.5.1, and it worked the same in that version.

https://docs.unity3d.com/351/Documentation/ScriptReference/Time-fixedDeltaTime.html