Search Unity

Offsets working in Auto but not in Apply Scene Offsets

Discussion in 'Timeline' started by pango, Apr 30, 2020.

  1. pango

    pango

    Joined:
    Jan 14, 2013
    Posts:
    12
    Hey
    I have a character with a controller, and a timeline animating this character. The timeline first apply a walk animation then an idle one, the walk one use root motion.
    The project was upgraded from 2017 to 2019, and while the character position works when i leave Track Offsets Mode to Auto, if I set it to Apply Scene Offsets (also with Apply Transform Offsets), when the idle animation comes, the character moves back to its position before the walk animation. Right Click and "match offset to previous clip" doesn't change anything (the offset is still almost 0, it does not seem to take into account the root motion of the clip). The timeline was working in 2017, and working in Auto.

    Also the preview of the timeline in the editor without entering play mode makes the character move in random positions.

    I've found this thread which is quite different but may be linked.

    Does anyone have an idea, since it is advised to not keep Auto mode in track offsets is deprecated?

    Thanks!
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    It sounds like the root motion in the clip isn't being read correctly, or that it is set to 0. In both cases (Auto, SceneOffsets) does the root transform update when the timeline plays, or does it stay unchanged?

    Have you tried to change the root motion import options of the animation clip?
     
  3. pango

    pango

    Joined:
    Jan 14, 2013
    Posts:
    12
    Thanks!
    Thanks for the answer!
    I call a signal at the beginning of the timeline to allow to call ApplyBuiltinRootMotion in OnAnimatorMove, and stop calling it after the end of the timeline, and the walk animation in the timeline moves the character as it should, so i guess the root motion works on the walk animation...

    After playing a bit with various stuff, it seems that if I remove the script that contains the OnAnimatorMove function on the character, "Match offsets to previous clip" on the idle animation manages to find the right offset, and the idle animations plays at the right position (just disabling the component does not work though, only removing it from the character). I thought that choosing "Apply Scene Offsets" in track offset setting would lead to not taking into account the offsets on the clips, but maybe it's the case only for the first animation?

    On a side note, the preview when not in play mode still doesn't work.
     
  4. pango

    pango

    Joined:
    Jan 14, 2013
    Posts:
    12
    I saw this thread, also answered by you, it seems adding [ExecuteInEditMode] to the class containing OnAnimatorMove also allow to have the right offset on Match Offset To Previous Clip
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Ok, that makes sense. OnAnimatorMove also applies to timeline, not just animator.
     
  6. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    436
    I have the same issue, but enabling [ExecuteInEditMode] isn't an option for me. Is there any way to workaround it? Or maybe do you plan to fix this issue?
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    So you are overriding OnAnimatorMove, but it's on a script that you can't enable [ExecuteInEditMode] on? I haven't checked if disabling the script before matching offsets would work (it might). Alternatively you could use a clone of the gameobject without the script to author the animation track.

    As for a fix, we don't have anything planned that I am aware of.
     
  8. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    436
    Well, I didn't expect answer as dissapointing as this. Disabling script doesn't resolve this issue. Using object clones isn't an option for me as well.
     
    Last edited: May 11, 2020
    Whatever560 likes this.
  9. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    436
    Also I've noticed that timeline & offsets breaks tremendously when animator controls rig that isn't directly beneath in hierarchy. I've had to restructure my prefabs in order to make them work with timeline.

    Could you please take a look at this @seant_unity ?
     
    Alic likes this.
  10. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Gladly @nehvaleem, but can you file a bug report with a sample so that we are able to get full context of the issue?