Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug? Root Motion with cull completely not possible anymore since Unity 5.4?

Discussion in 'Animation' started by silentneedle, Dec 19, 2016.

  1. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    In our server app I'm applying root motion (by using animator.rootPosition) inside OnAnimatorMove, which worked great with unity 5.3, but after upgrading to unity 5.4 this doesn't work anymore. When changing the animator culling mode to always animate it's working fine, but requires way too much performance.

    The strange thing is that ApplyOnAnimatorMove is called not matter what culling mode is used, but it seems the code inside is only getting executed if alwaysanimate is selected.

    Is this intended?
     
  2. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    After a little testing it seems the code inside OnAnimatorMove gets executed, but animator.rootPosition doesn't receive any updates if CullCompletely is active, which makes it impossible to apply root motion.
     
  3. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    A word from an unity dev would be great, as this change seems to be undocumented. :(
     
    Last edited: Dec 21, 2016
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    this is not a know issue, could you please log a bug.

    OnAnimatorMove is always called because this is how you move you're object around which have a direct impact on culling state, the culling is done right after this callback.
     
  5. Critical

    Critical

    Joined:
    Aug 7, 2012
    Posts:
    5
    I have the same problem and filed a bug report some time ago (Case 868744). As a workaround it's possible to set the culling mode to CullUpdateTransforms ("The statemachine and root motion will always be evaluated." - Scripting Reference). There will still be a minor performance impact, even when running the application in batchmode, but at least rootPosition gets updated.

    @Mecanim-Dev The question is if the animator.rootPosition value is meant to be updated when AnimatorCullingMode.CullCompletely is active. Maybe you can shed some light on this, unfortunately the documentation doesn't make it clear enough, it just states that the "Animation is completely disabled", but does this also include the evaluation of root motion AND the related variables (e.g. rootPositon)?
     
  6. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    CullUpdateTransforms is the mode you're supposed to use if you want root motion to be updated offscreen.
    CullCompletely updating root motion of objects off screen is not the expected behaviour. I'm fairly certain we fixed a bug around 5.5 about this.