Time.deltaTime is not equal to Time.unscaledDeltaTime * Time.timeScale

Looking at documentation of Time.unscaledDeltaTime, you might think that Time.deltaTime is actually equal to Time.unscaledDeltaTime * Time.timeScale, but this is not true. Time.deltaTime is clamped to Time.maximumDeltaTime, but Time.unscaledDeltaTime is not clamped at all.

So if you use Time.unscaledDeltaTime without clamping for, say, interpolation, you might get stuttering motion if your scaled frame time goes above Time.maximumDeltaTime.

Note that by default Time.maximumDeltaTime is set to 1/3, which is most likely not going to be exceeded in any project. I stumbled upon this problem only because I changed Time.maximumDeltaTime to a pretty low value.

This is how you clamp Time.unscaledDeltaTime:

var clampedUnscaledDeltaTime = Time.unscaledDeltaTime;
if (Time.timeScale != 0)
    clampedUnscaledDeltaTime = Mathf.Min(clampedUnscaledDeltaTime, Time.maximumDeltaTime / Time.timeScale);

In the end I’d like to see Time.maximumDeltaTime mentioned in both delta time pages.
Because if it’s not, someone might spend a bit more time debugging, like me :slight_smile:

The correct place to make documentation feedback is in the Documentation forum.

I’ll move your post there.