I made a simple interpolation code using Update() and FixedUpdete(), based on deltatime after last FixedUpdate() execution.
But I met strange ratio of delta time error of GameTime between Update() and FixedUpdate().
To be simple:
public override void OnUpdate() { Debug.Log($"Update, Gametime :{FlaxEngine.Time.GameTime}"); } public override void OnFixedUpdate() { Debug.Log($"Fixed Update, GameTime:{FlaxEngine.Time.GameTime}"); }
Resulted following output log:
[ 16:40:33.913 ]: [Info] Update, Gametime :506.75983
[ 16:40:33.927 ]: [Info] Fixed Update, GameTime:506.54108
[ 16:40:33.931 ]: [Info] Update, Gametime :506.77652
[ 16:40:33.944 ]: [Info] Fixed Update, GameTime:506.55774
[ 16:40:33.947 ]: [Info] Update, Gametime :506.79318
[ 16:40:33.960 ]: [Info] Fixed Update, GameTime:506.5744
[ 16:40:33.963 ]: [Info] Update, Gametime :506.80988
[ 16:40:33.977 ]: [Info] Fixed Update, GameTime:506.5911
[ 16:40:33.980 ]: [Info] Update, Gametime :506.8265
[ 16:40:33.994 ]: [Info] Fixed Update, GameTime:506.60773
[ 16:40:33.998 ]: [Info] Update, Gametime :506.8432
[ 16:40:34.011 ]: [Info] Fixed Update, GameTime:506.62442
[ 16:40:34.014 ]: [Info] Update, Gametime :506.85983
[ 16:40:34.027 ]: [Info] Fixed Update, GameTime:506.64105
[ 16:40:34.030 ]: [Info] Update, Gametime :506.87653
[ 16:40:34.044 ]: [Info] Fixed Update, GameTime:506.65775
[ 16:40:34.047 ]: [Info] Update, Gametime :506.89316
[ 16:40:34.061 ]: [Info] Fixed Update, GameTime:506.67438
[ 16:40:34.063 ]: [Info] Update, Gametime :506.90985
[ 16:40:34.077 ]: [Info] Fixed Update, GameTime:506.69107
[ 16:40:34.081 ]: [Info] Update, Gametime :506.92648
[ 16:40:34.094 ]: [Info] Fixed Update, GameTime:506.70773
[ 16:40:34.097 ]: [Info] Update, Gametime :506.94318
[ 16:40:34.111 ]: [Info] Fixed Update, GameTime:506.7244
[ 16:40:34.113 ]: [Info] Update, Gametime :506.95984
[ 16:40:34.127 ]: [Info] Fixed Update, GameTime:506.74106
Apparently, FixedUpdate() called got less value of GameTime variable than Update(), regardless of sequence of calling. Headers of logs show the stable steps of 60FPS and deltas between Update<->Update and FixedUpdate<->FixedUpdate shows correct value of delta time, but timing calculation inside FixedUpdate is lagged behind Update about ~10x frames.
Is FlaxEngine.Time.GameTime desynced between OnUpdate and OnFixedUpdate?