Search Unity

5.4 Beta Bug: AnimatorCullingMode.CullUpdateTransforms causes OnStateEnter and others not called

Discussion in 'Animation' started by kierand, Apr 7, 2016.

  1. kierand

    kierand

    Joined:
    Sep 22, 2014
    Posts:
    32
    5.4 Beta Bug: AnimatorCullingMode.CullUpdateTransforms causes StateMachineBehaviour.OnStateEnter, StateMachineBehaviour.OnStateExit and animation events to not be called in some cases.

    This is reported as bug case number 786483. Note there are not any attached files to the bug or a repro project yet as it will be incredibly hard to create one. Posting this here in the hope that someone goes "aha, yes I can see why that would have broken".

    We use StateMachineBehaviour.OnStateEnter on some states to disable movement for that AI and StateMachineBehaviour.OnStateExit to re-enable it again. Since upgrading to 5.4 we would find that AI could end up not moving after a while. Further investigation showed that some times StateMachineBehaviour.OnStateEnter, StateMachineBehaviour.OnStateExit and animation events do not fire. Changing from AnimatorCullingMode.CullUpdateTransforms to AnimatorCullingMode.AlwaysAnimate stops this happening so it appears that AnimatorCullingMode.CullUpdateTransforms is culling more than it should now.

    Work around: Change to AnimatorCullingMode.AlwaysAnimate. This has a performance impact.
     
  2. kierand

    kierand

    Joined:
    Sep 22, 2014
    Posts:
    32
    This is fixed in b21!