Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.33k stars 348 forks source link

Dotween handling of dropped frames/compensating for slow execution #552

Open ehudros opened 2 years ago

ehudros commented 2 years ago

Hi! We're using Dotween for ages now and were always under the impression (or assumption) that tweens duration is separate from actual frame rate. In an extreme scenario, to illustrate: if a tween is meant to run for 1 second, but another process hogs the cpu for the whole duration, the tween will immediately end ("teleporting" immediately to the end state). However running a simple test shows this not to be the case: ` Debug.Log("Start"); var s = DOTween.Sequence(); s.InsertCallback(0f, () => {

            int i = 0;
            while (i < Int32.MaxValue)
                i++;
            Debug.Log("done");
        });
        s.Insert(0f, image1.transform.DOMoveX(-2, 0.3f).SetRelative(true));
    }`

What we expected to see is the image immediately teleporting to the end position, since the callback just before has taken about 2 seconds to complete. However what actually happens is that everything freezes for 2 seconds, and then the image starts tweening normally and takes 0.3 seconds to complete. Are we assuming something that isn't supported? Can't we rely on Dotween animations to take the exact same real time duration on all devices?

Thanks!

Demigiant commented 2 years ago

Ahoy,

What you're expecting is exactly what should happen, so this is weird unless you enabled smoothDeltaTime in DOTween's preferences. Can you check that? And if it's not enabled let me know your Unity version so I can check what's happening.