UniTask icon indicating copy to clipboard operation
UniTask copied to clipboard

WaitForFixedUpdate does not work as described

Open Qriva opened this issue 3 years ago • 2 comments

This line from documentation is wrong:

// replacement of yield return new WaitForFixedUpdate(same as UniTask.Yield(PlayerLoopTiming.FixedUpdate))
await UniTask.WaitForFixedUpdate();

Coroutine WaitForFixedUpdate is called the same frame after physics update and when used in OnTirggerXYZ family callbacks it will correctly be called the same frame after callbacks. Unitask behaviour is different - it will be called next frame and probably at the beggining of FixedUpdate. To get the same behaviour I needed to use UniTask.Yield(PlayerLoopTiming.LastFixedUpdate);

Qriva avatar Jul 17 '22 14:07 Qriva

Thank you very much. After verification, I may change the implementation of WaitForFixedUpdate (since the same behavior is desirable).

neuecc avatar Jul 21 '22 10:07 neuecc

Please. I just came across a similar issue where a bug was introduced because I expected the behaviour to be the same.

aidenatgravitysketch avatar Aug 03 '22 14:08 aidenatgravitysketch

released at 2.3.2.

neuecc avatar Oct 24 '22 13:10 neuecc