If you need to play a series of animations one after the other, you could do it manually by giving them each an End Event which plays the next animation. But that makes it hard to do things like initialise their events or calculate the time remaining in the sequence so TransitionSequence
s and SequenceState
s allow you to define a sequence of Transitions or States and work with them as a group.
A similar result can be achieved using Timeline which is generally more powerful, but also more complex to use.
Transition Sequences
TransitionSequence
s can be used just like any other Transition by creating a serialized field, configuring their details in the Inspector, and then playing them which creates a SequenceState
at runtime.
using Animancer;
using Animancer.Samples;
using UnityEngine;
public class TransitionSequenceExample : MonoBehaviour
{
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private ClipTransition _Idle;
[SerializeField] private TransitionSequence _ActionSequence;
protected virtual void OnEnable()
{
_Animancer.Play(_Idle);
}
protected virtual void Update()
{
if (SampleInput.LeftMouseDown)
{
AnimancerState state = _Animancer.Play(_ActionSequence);
state.Events(this).OnEnd ??= () => _Animancer.Play(_Idle);
}
}
}

- The sequence simply contains an array of child Transitions which will usually be
ClipTransition
s but could potentially contain any other Transition Type in unusual use cases. - Most properties of the child Transitions work normally with a few exceptions:
- The
Fade Duration
of the first child is ignored because the sequence has its ownFade Duration
. - Leaving the
Start Time
disabled is the same as setting it to0
because the sequence explicitly manages the timings of its children so where it shows "Continue from current time" the current time of that child at that point in the sequence will always be0
.
- The
- If you want to use Animancer Events on the sequence or its children, the best way to do so is usually to bind the events by name using the Central Event system so that your scripts don't need to know about the specific setup of the sequence.
- Sequences can also be used in Transition Assets.