The AnimancerComponent
is the main entry point for controlling animations with Animancer. It also has several sub-classes with additional functionality:
AnimancerComponent
: the base class with all the core functionality.
Examples: Quick Play (and most others)
The base component which wraps the core functionality of Animancer.
The Animator
field references the Animator
component that Animancer will control.
The Action On Disable
field determines which DisableAction
will be used when the object is disabled.
NamedAnimancerComponent
: registers animations by name so that you can use TryPlay("Animation Name")
.
Examples: Named Animations
Inherits from AnimancerComponent
.
Overrides the GetKey
method to use the animation name so that you can use TryPlay("Animation Name")
. See the Keys section for more information.
The Animations
array allows you to pre-register AnimationClip
s (so you can TryPlay
them by name like in Unity's Legacy Animation
component).
The Play Automatically
toggle determines if you want it to play the first animation in the list on startup.
HybridAnimancerComponent
: allows for a Hybrid combination of an Animator Controller and Animancer.
Examples: Hybrid Basics and Hybrid Character
Inherits from NamedAnimancerComponent
.
The Controller
field allows for a Hybrid combination of an Animator Controller and Animancer.
Pro-Only: Animancer Lite allows you to try out this feature in the Unity Editor, but it will not be available in runtime builds unless you purchase Animancer Pro. See the Feature Comparison for more information.
SoloAnimation
: plays one animation.
Examples: Solo Animation
Plays one animation which can be assigned in the Inspector without the performance overhead of the rest of Animancer.
That's all it does. It doesn't support Fading or Layers or Animancer Events or any of the other features of Animancer. It is not even really part of Animancer, it is just a self-contained script designed to play that one animation and nothing else. If you want to do anything more than that you are likely better off using a proper AnimancerComponent
.
Adding Components
When using the Add Component
menu in the Unity Editor, all of Animancer's components are located in the Animancer
sub-menu.
Source Code
The scripts containing these components are located in the Assets/Plugins/Animancer
folder and they are even included in Animancer Lite, so you can modify or Inherit from them to implement your own variations. For example, you could:
- Inherit from
AnimancerComponent
and add aSpriteRenderer
orSkinnedMeshRenderer
field so you can reference it alongside the animations. - Make a
CharacterAnimationSet
class which inherits fromScriptableObject
to define a set of animations for each character and then make aCharacterAnimancer
class which inherits fromAnimancerComponent
to allow a character to reference one of those animation sets in the same place as the rest of the animation functionality. - Inherit from
NamedAnimancerComponent
and add an array ofstring
s so that you can specify a custom name for each animation rather than always using the exactAnimationClip.name
. - Inherit from
AnimancerComponent
and add someAnimationEventReceiver
s to listen for certain Animation Events.