Search Unity

Rootmotion timeline (Animator) OnAnimatorMove on disabled component

Discussion in 'Timeline' started by Censureret, Aug 3, 2020.

  1. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    So i have a script on a GameObject that implements the function:

    "OnAnimatorMove"

    The object that contains this script is the one that i want to manipulate with Timeline and when i do I want to apply root motion to my character but he is not moving.

    So I started looking into it and it seems for the most part that if a gameobject has a script that overrides the above function then root motion is not being applied.

    So naturally, I decided to disable the component that has this function however to my surprise the root motion is still not being applied.

    I also tried to create another character and not assign the script component to it with the same timeline-track and here the root motion worked as intended so it must be the component in question that somehow still is manipulating the animator even though its not active.

    how is this possible and what can you do to work around it?
     
    Last edited: Aug 3, 2020
  2. dyburke

    dyburke

    Joined:
    Nov 11, 2012
    Posts:
    15
    There seems to be a lot of weirdness with OnAnimatorMove and Timeline. Especially when it comes to the root motion checkbox on the Animator being removed due to the fact you've got a component (disabled or not) that uses OnAnimatorMove on the object.

    Even though it should work like this, try removing the OnAnimatorMove script, then setting the root motion option on your animator, then add the OnAnimatorMove script back onto the object.

    And if you figure out how to, in OnAnimatorMove, tell whether a user is scrubbing forwards or backwards and by how many frames I would love to know. :)

    EDIT: Specifically, I believe the animator does not attempt to add root motion when you implement OnAnimatorMove (which is why the option disappears on the Animator), but it also doesn't seem to check whether the component implementing OnAnimatorMove is going to execute.