[Bug] await MotionHandle does not complete when calling handle.Cancel()
AnnulusGames opened this issue · 3 comments
AnnulusGames commented
Await does not complete when MotionHandle is canceled while waiting with await.
[UnityTest]
public IEnumerator Test_CancelWhileAwait() => UniTask.ToCoroutine(async () =>
{
var handle = LMotion.Create(0f, 10f, 1f).BindToUnityLogger();
DelayedCall(0.2f, () => handle.Cancel()).Forget();
await handle; // never complete
});
async UniTaskVoid DelayedCall(float delay, Action action)
{
await UniTask.WaitForSeconds(delay);
action.Invoke();
}
Akeit0 commented
I think creating bool TreatCancelAsComplete
or enum CancelBehaviour
and allowing access and modification from the handle would solve the problem.
AnnulusGames commented
Fixed in #15
Akeit0 commented
This doesn't work with WithCancelOnError.