• RuntimesUnity
  • How to mix two animation on a same track?

Hello everyone, I am trying to implement the following animation blending in a timeline using C#.

As you can see, the "start" animation is a 20-seconds-long animation and it is non-looping. The mix time is 2s. The "idle" animation is a looping animation, so here is my code:
TrackEntry Ani1 = AnimationState.SetAnimation(0, aimFirst, false);
Ani1.MixDuration = 2.0f;
AnimationState.AddAnimation(0, aimSecond, true, 0);

However, the code seems not working as the timeline result.

Related Discussions
...

@Levin You need to set MixDuration = 2.0f of the second animation, not the first one if you want to mix between first and second animation over 2.0 seconds.

AnimationState.SetAnimation(0, aimFirst, false);
TrackEntry ani2 = AnimationState.AddAnimation(0, aimSecond, true, 0);
ani2.MixDuration = 2.0f; // Set mix duration for the second animation

I've deleted the posting by Spinebot which was perhaps a bit confusing.