time.unscaledDeltaTime begin with high number

when i write debug to display time.unscale delta time (i write it in update) in the first frame the value is very
high , why its so high in the first frame? its bug or im missing something?

First frame is always iffy: could be loading, CPU caching, graphics stall, OS process fiddling, could be anything.

ALL of my games have a single-frame black-background scene called zeroscene.unity with a single script called zeroscene.cs and all it does is go to the next scene.

1 Like

The first frame of the scene play? Yeah it should be considerably slower than other frames with less things to process. delta time, is the time it takes between logical frames in unity. So it seems normal and not a bug.

ok so ןim curious why its not happend with when i write debug of time.delta time?(its show me usually 0.02 in the first frame its very small change from the next frames but with unsceled its show me in the first frame numbes like 3f,4f atc very different from the next frames )time.delta time in the first frame not affected from proceed things like time.unsceled delta time?

Because Time.deltatime and Time.time are scaled. Unity adjusts that time data for simulation.

Time.unscaledTime and Time.unscaledDeltaTime.

What’s likely happening is unity doesn’t use a timescale between Awake and the first Update call to avoid those sorts of things.

If it’s a problem come up with a way to ignore it on the first frame like @Kurt-Dekker suggested.

1 Like

ok intersting i think figure out what heppend the calculation of the first frame with time.unscaled time happned from the moment when i prees play becouse its not scaled till the game actually running when time delta like you say unity adjust the data time and the calculation of the first update begin only when the game actually running

Weird. Perhaps the baselines for all Unscaled Time and RealTimeSinceStartup are measured in a different place? Unscaled is done statically and happens before scene load maybe? Either way, I’d call that a bug,

Submit a bug report with minimal repo case. The two values really ought to be comparable from frame 1 if game time isn’t being scaled. There’s no limit to how large Time.deltaTime can be and they should all be measured from the same baselines.

1 Like