Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Relationship between animator component and timeline animation track

Discussion in 'Timeline' started by vousmovoyez, Nov 27, 2019.

  1. vousmovoyez

    vousmovoyez

    Joined:
    Sep 2, 2019
    Posts:
    2
    I'm new on Unity Timeline. When I link a GameObject to a Timeline Animation Track, it requires to create an animator component on this GameObject.
    I'm wondering why animator component affects Timeline. As I know, Timeline and Animator use different methods to update. What property of the animator component will be replaced by Timeline, only animation clip or the whole component?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,194
    The Animator is responsible for playing the animation playable graph provided by timeline. The animator controller, timeline, runtime rigging, simple animation and others all generate graphs of animation playables and the animator is responsible for processing them all, and blending the results together if needed.
     
  3. mateuszjaworski

    mateuszjaworski

    Joined:
    Aug 8, 2019
    Posts:
    4
    That's fair. But can we achieve blending two animation tracks in this same timeline? In state machine we can easily access other layers to introduce blending. In my project I want to use additive animation to tweak some details in base animation. I could easily do that with PlayablesAPI. Here is a code example:

    Code (CSharp):
    1.         g = PlayableGraph.Create("anim");
    2.        
    3.         var mixMain = AnimationPlayableUtilities.PlayLayerMixer(GetComponent<Animator>(), 1, out g);
    4.         mixMain.SetLayerAdditive(0, true);
    5.        
    6.         var a1 = AnimationClipPlayable.Create(g, _move);
    7.         mixMain.AddInput(a1, 0, 1);
    8.        
    9.         var a2 = AnimationClipPlayable.Create(g, _rotate);
    10.         mixMain.AddInput(a2, 0, 1);
    11.  
    12.         g.Play();
    But when it comes to timeline I don't know how can I produce this same result. I am trying to extend AnimationTrack, but it seems like many methods there are not overridable. I've also tried to look at ILayerable from 2019.3.11b, but I failed there as well. Any tips?
     
  4. arkamarante

    arkamarante

    Joined:
    Oct 8, 2012
    Posts:
    3
    Any news on this?
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,194
    You can create override layers on the animation track (right click on the track -> Add Layer), but unfortunately they can't be set to additive yet.

    From the API, override layers can be created by passing the base layer into TimelineAsset.CreateTrack<AnimationTrack>(parentTrack, name);
     
unityunity