bug: real-time animations take more time than expected
Description
Real-time animations (SetUpdate(UpdateType updateType, bool isIndependentUpdate) with isIndependentUpdate=true) take more time than they should, with slowdown dependent on the framerate (higher framerate - longer animations).
Cause
The cause of the issue is that Time.realtimeSinceStartup is accessed twice in DG.Tweening.Core.DOTweenComponent.Update() (lines 72 and 77). But its value changes between the reads, so the time to process animations is not accounted for.
The relevant part of the Update() method:
https://github.com/Demigiant/dotween/blob/5f20f92ca783c45d381e275bdcf680a6d6a245c0/_DOTween.Assembly/DOTween/Core/DOTweenComponent.cs#L72-L77
From the Unity docs on Time.realtimeSinceStartup:
This is the time in seconds since the start of the application, and is not constant if called multiple times in a frame. [emphasis mine]
Solution
Read Time.realtimeSinceStartup once at the start of the method.