Search Unity

Timeline first frame comes from Animator in Play mode

Discussion in 'Timeline' started by Jawsarn, Feb 26, 2018.

  1. Jawsarn

    Jawsarn

    Joined:
    Jan 12, 2017
    Posts:
    245
    Couldn't find any answer by searching, this feels like problem nr 0.

    I have an animation on a character in a timeline.
    If I go and play the scene the first frame will be using the animation from the animator, (bind pose if no controller is set etc). Which makes it annoying to have a controller for each animation that starts at time 0 in timeline.

    Is there a way to fix this? I simply want the Timeline to override at frame 0, and not some lazy frame 1.
    (I can't just start recording frame 1, since there are particle systems and other things involved.)

    Thanks for any hints!
     
  2. spykkey

    spykkey

    Joined:
    May 25, 2015
    Posts:
    1
    Hey Jawsarn (and anyone googling this), you've probably found a workaround by now but I've also encountered this problem and it gave me major headaches.

    Here is what I did : When I want to call Play() on a specific director, I call Evaluate() in the same frame. It basically looks like this:

    Code (CSharp):
    1. public Actor myActor;
    2. private PlayableDirector myPlayableDirector;
    3.  
    4. myPlayableDirector = myActor.GetComponent<PlayableDirector>();
    5.  
    6. myPlayableDirector.Evaluate();
    7. myPlayableDirector.Play();
    I know it sounds super dumb, but it seems like calling the evaluate forces timeline to update the animator in the current frame, which will make your animation pop (and headaches) disappear.

    Hope it helps!