-
Notifications
You must be signed in to change notification settings - Fork 130
Description
This is insanely hard to debug and I have no idea what is the exact cause of this.
.WithEase(gameplaySpecs.hitPushbackEase)
.WithScheduler(OwnTimeManager.MotionDispatcher.Scheduler)
.Bind(this, (value, target) => {
if (this == null) return;
var velocity = normalizedDirection * value;
ExternalForceMovementStep(velocity, true);
CommandFacingX = facingBeforeMove;
});
Debug.Log(motion.Time);
This is the code that calls the WithScheduler. The Manual Scheduler is updated inside a custom player loop as the very last item in the TimeUpdate PlayerLoop (that said, the same issue also happens if the manual scheduler is updated inside a regular game update loop).
This code is executed in another customer player loop at the very end of the Update player loop.
On the very first execution, this Motion internal time will always be the same as the motion dispatcher time (instead of 0), even if the Debug.Log here log out 0 for motion.Time. Therefore, the motion functionally will not execute from 0 to duration, but instead from the current time to duration.
This issue only happens on the very first execution (even on a fresh EnterPlayMode). Any subsequence executions run correctly.
P/S: after further testing, it happens for the very first LitMotion. Right after I create the ManualMotionDispatcher, if I just add a dummy LitMotion, all the following ones run correctly. It seems to be an issue with initialization.
This issue doesn't happen if we use any other existing scheduler, so this seems to be an exclusive problem with manual motion dispatcher