Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Animator seems to be overwriting Timeline behavior

Discussion in 'Timeline' started by AdamBL, Dec 13, 2018.

  1. AdamBL

    AdamBL

    Joined:
    Oct 27, 2016
    Posts:
    28
    Hey all,

    Here's the setup:

    I have an object that is controlled by the Timeline, but also has an Animator component on it with a functioning state machine.

    At the start of the Timeline, there's an animation clip that increases the scale of the object from 0 to 1 (making it appear). At any point, the user can press a button to trigger a change in the Animator that plays an animation setting the scale from 1 to 0 (making it disappear). Then, when the user presses another button, the Timeline restarts, playing the scale up animation again. This mostly works, except when the scale up animation finishes playing for the second time, the scale immediately reverts back to 0.

    In order to allow for the Animator to take over, I had to set the Post-Extrapolate behavior of the Timeline clip to None. What I'm assuming is happening is that when the clip is done playing, the Timeline hands the control of the clip back to the Animator, which has most recently played the scale down animation, and thinks the scale should be 0. What's confusing me is I have all states in the Animator set to NOT Overwrite Defaults so I'm not sure why this is happening.

    Regardless, is there a good way to mix a Timeline with dynamic/procedural animation coming from an Animator?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    644
    The timeline is being played on top of the state machine (i.e. both are running), so what is the state machine doing while and after the timeline runs? I am guessing the state machine is still writing the same thing it was before the timeline started, which might include 0 scale?
     
  3. AdamBL

    AdamBL

    Joined:
    Oct 27, 2016
    Posts:
    28
    The state machine has a default state with no animation on it. To my knowledge, it shouldn't be writing anything. Or does it?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    644
    I just asked the anim team, and yes it always writes a pose. Even if it's empty.
     
  5. AdamBL

    AdamBL

    Joined:
    Oct 27, 2016
    Posts:
    28
    Is there any way to stop it from writing? Or give control back to the timeline?
     
    tarahugger likes this.
  6. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    69
    Try Animator.playableGraph.GetOutput(0).SetWeight(0);
     
    seant_unity likes this.