Each of the State types that are included in Animancer has its own Transition type which contains various details relevant to it so that when passed into AnimancerComponent.Play(ITransition)
it will create that type of state. For example, a ClipTransition
will create a ClipState
to play a single AnimationClip
.
There are several major categories of transitions:
- Basic Transitions for playing individual
AnimationClip
s and Timelines. - Mixer Transitions for blending multiple animations using Mixers.
- Controller Transitions for playing Animator Controllers.
Serialized References
Unity's serialization system doesn't normally support inheritance, however the [SerializeReference]
attribute allows it to do so. Placing that attribute on a transition field allows you to choose which type of transition you actually want to use with a dropdown menu in the Inspector without your code needing to know the specific type.
ClipTransition |
ITransition |
---|---|
|
|
This allows you to select ClipTransition or anything that inherits from it such as a ClipTransitionSequence or a MotionTransition from the Root Motion example. |
This allows you to select any transition type which is usually a bad idea because code that expects to control a Mixer State won't work with a Controller State or a simple ClipState . |
Every type of State also has its own nested ITransition interface for transitions that specifically create that type of state (e.g. ClipState.ITransition ). This includes the UnShared type for that state so your code doesn't even need to know whether it is using a regular transition or a Transition Asset. |
The Polymorphic Drawer system also allows you to use this feature on other unrelated types.
Basic Transitions
Type | Details |
---|---|
AnimancerTransition<TState> |
abstract base class for all other transitions. Only has a FadeDuration field. |
ClipTransition |
Inherits from |
ClipTransitionSequence |
Inherits from |
PlayableAssetTransition |
Inherits from |
Mixer Transitions
These transitions create various types of Mixer States. They all use reorderable lists to configure their states. You can Right Click on any of the transition fields to open a context menu with several useful functions.
Type | Details |
---|---|
ManualMixerTransition<TMixer> |
abstract base class for transitions that create states derived from ManualMixerState . |
ManualMixerTransition |
Inherits from |
MixerTransition<TMixer, TParameter> |
abstract base class for transitions that create states derived from MixerState . Has a Thresholds array and DefaultParameter field. |
LinearMixerTransition |
Inherits from |
MixerTransition2D |
Inherits from |
Controller Transitions
These transitions create various types of Controller States.
Type | Details |
---|---|
ControllerTransition<TState> |
abstract base class for transitions that create states derived from ControllerState . |
ControllerTransition |
Inherits from |
Float1ControllerTransition Float2ControllerTransition Float3ControllerTransition |
Inherits from |
Custom Transitions
You can create your own transitions by implementing ITransition
from scratch or inheriting from AnimancerTransition
or any of its derived types. When doing so, you may also want to alter the way it is drawn in the Inspector by creating another class that inherits from the Drawer
class inside the Transition
you are inheriting from or implementing your own PropertyDrawer
.
The Root Motion example implements a class that inherits from ClipTransition
to add an ApplyRootMotion
field to determine whether the Animator.applyRootMotion
should be enabled for each animation.