Summary
The main component through which other scripts can interact with
Animancer
. It allows you to play
animations on an UnityEngine.Animator
without using a UnityEngine.RuntimeAnimatorController
.
- Assembly
- Animancer
.dll - Namespace
- Animancer
- Interfaces
-
- IAnimancerComponent
- IEnumerator
- IAnimationClipSource
- I
Animation Clip Collection
- Base Types
-
- MonoBehaviour
- Derived Types
graph BT
Type-->Base0["MonoBehaviour"]
Type-.->Interface0["IAnimancerComponent"]
click Interface0 "/animancer/api/Animancer/IAnimancerComponent"
Type-.->Interface1["IEnumerator"]
Type-.->Interface2["IAnimationClipSource"]
Type-.->Interface3["IAnimationClipCollection"]
click Interface3 "/animancer/api/Animancer/IAnimationClipCollection"
Type["AnimancerComponent"]
class Type type-node
Derived0["NamedAnimancerComponent"]-->Type
click Derived0 "/animancer/api/Animancer/NamedAnimancerComponent"
Syntax
[AddComponentMenu(Strings.MenuPrefix + "Animancer Component")]
[AnimancerHelpUrl(typeof(AnimancerComponent))]
[DefaultExecutionOrder(DefaultExecutionOrder)]
public class AnimancerComponent : MonoBehaviour, IAnimancerComponent, IEnumerator,
IAnimationClipSource, IAnimationClipCollection
Remarks
This class can be used as a custom yield instruction to wait until all animations finish playing.
This class is mostly just a wrapper that connects an
Animancer.AnimancerGraph
to an
UnityEngine.Animator
.
Documentation:
Component Types
Attributes
Type | Description |
---|---|
AddComponentMenu | |
Animancer |
[Assert-Conditional]
A UnityEngine.HelpURLAttribute which points to Animancer's documentation.
|
Default |
Fields
Name | Constant Value | Summary |
---|---|---|
Default |
-5000 |
Initialize before anything else tries to use this component.
static
|
Properties
Name | Value | Summary |
---|---|---|
ActionOnDisable | AnimancerComponent |
[
UnityEngine.SerializeField ]
Determines what happens when this component is disabled
or its UnityEngine.GameObject becomes inactive
(i.e. in Animancer.AnimancerComponent.OnDisable ).
|
Animator | Animator |
[
UnityEngine.SerializeField ]
Animancer works by using Unity's Playables API to control an UnityEngine.Animator component.
|
Events | NamedEventDictionary |
A dictionary of callbacks to be triggered by any event with a matching name.
|
Graph | AnimancerGraph |
The internal system which manages the playing animations.
Accessing this property will automatically initialize it.
|
InitialUpdateMode | Nullable |
[Editor-Only] The
Animancer.IAnimancerComponent.UpdateMode that was first used when this script initialized. |
IsGraphInitialized | bool |
Has the
Animancer.AnimancerComponent.Graph been initialized? |
Layers | AnimancerLayerList |
The layers which each manage their own set of animations.
|
Parameters | ParameterDictionary |
Dynamic parameters which anything can get or set.
|
States | Animancer |
The states managed by this component.
|
Transitions | Transition |
[
UnityEngine.SerializeField ] [Pro-Only]
An optional Animancer.TransitionLibraries.TransitionLibraryAsset
which can modify the way Animancer transitions between animations.
|
UpdateMode | AnimatorUpdateMode |
Determines when animations are updated and which time source is used. This property is mainly a wrapper
around the
UnityEngine.Animator.updateMode .
|
Methods
Name | Value | Summary |
---|---|---|
~AnimancerComponent |
void |
[Editor-Only]
Ensures that the
Animancer.AnimancerGraph is destroyed in Edit Mode, but not in Play Mode since we want
to let Unity complain if that happens.
|
Evaluate |
void |
Immediately applies the current states of all animations to the animated objects.
|
Evaluate |
void |
Advances time by the specified value (in seconds) and immediately applies the current states of all
animations to the animated objects.
|
GatherAnimationClips |
void |
[
Animancer.IAnimationClipCollection ]
Gathers all the animations in the Animancer.AnimancerComponent.Graph .
In the Unity Editor this method also gathers animations from other components on parent and child objects.
|
GetAnimationClips |
void |
[
UnityEngine.IAnimationClipSource ]
Calls Animancer.AnimancerComponent.GatherAnimationClips(System.Collections.Generic.ICollection{UnityEngine.AnimationClip}) .
|
GetKey |
Object |
Returns the `clip` itself.
|
InitializeGraph |
void |
Creates and initializes the
Animancer.AnimancerComponent.Graph if it wasn't already initialized. |
InitializePlayable |
void |
Sets the
Animancer.AnimancerComponent.Graph and connects it to the Animancer.AnimancerComponent.Animator . |
IsPlaying |
bool |
Returns true if at least one animation is being played.
|
IsPlaying |
bool |
[Warning]
You should not use an
Animancer.AnimancerState as a key.
Just check Animancer.AnimancerState.IsPlaying .
|
IsPlaying |
bool |
Returns true if a state is registered for the `clip` and it is currently playing.
The actual dictionary key is determined using
Animancer.AnimancerComponent.GetKey(UnityEngine.AnimationClip) .
|
IsPlaying |
bool |
Returns true if a state is registered with the
Animancer.IHasKey.Key and it is currently playing.
|
IsPlaying |
bool |
Returns true if a state is registered with the `key` and it is currently playing.
|
IsPlayingClip |
bool |
Returns true if the `clip` is currently being played by at least one state.
This method is inefficient because it searches through every state to find any that are playing the `clip`,
unlike
Animancer.AnimancerComponent.IsPlaying(UnityEngine.AnimationClip) which only checks the state registered using the `clip`s key.
|
OnDestroy |
void |
Ensures that the
Animancer.AnimancerComponent.Graph is properly cleaned up. |
OnDisable |
void |
Acts according to the
Animancer.AnimancerComponent.ActionOnDisable . |
OnEnable |
void |
Ensures that the
UnityEngine.Playables.PlayableGraph is playing. |
OnInitializeGraph |
void |
Called right after the
Animancer.AnimancerComponent.Graph is initialized. |
Play |
AnimancerState |
Stops all other animations on the same layer, plays the `state`, and returns it.
|
Play |
AnimancerState |
Starts fading in the `state` while fading out all others in the same layer over the course of the
`fadeDuration`. Returns the `state`.
|
Play |
AnimancerState |
Stops all other animations on the same layer, plays the `clip`, and returns its state.
|
Play |
AnimancerState |
Starts fading in the `clip` while fading out all other states in the same layer over the course of the
`fadeDuration`. Returns its state.
|
Play |
AnimancerState |
Creates a state for the `transition` if it didn't already exist, then calls
Animancer.AnimancerComponent.Play(Animancer.AnimancerState) or Animancer.AnimancerComponent.Play(Animancer.AnimancerState,System.Single,Animancer.FadeMode)
depending on ITransition.CrossFadeFromStart .
|
Play |
AnimancerState |
Creates a state for the `transition` if it didn't already exist, then calls
Animancer.AnimancerComponent.Play(Animancer.AnimancerState) or Animancer.AnimancerComponent.Play(Animancer.AnimancerState,System.Single,Animancer.FadeMode)
depending on ITransition.CrossFadeFromStart .
|
Reset |
void |
[Editor-Only]
Destroys the
Animancer.AnimancerComponent.Graph if it was initialized and searches for an Animancer.AnimancerComponent.Animator on
this object, or it's children or parents.
|
Stop |
void |
Stops all animations and rewinds them to the start.
|
Stop |
AnimancerState |
[Warning]
You should not use an
Animancer.AnimancerState as a key.
Just call AnimancerState.Stop .
|
Stop |
AnimancerState |
Gets the state associated with the `clip`, stops and rewinds it to the start, then returns it.
|
Stop |
AnimancerState |
Gets the state registered with the
Animancer.IHasKey.Key , stops and rewinds it to the start, then
returns it.
|
Stop |
AnimancerState |
Gets the state associated with the `key`, stops and rewinds it to the start, then returns it.
|
TryGetAnimator |
bool |
Tries to ensure that an
Animancer.AnimancerComponent.Animator is present using
UnityEngine.Component.TryGetComponent``1(``0@) if necessary.
|
TryPlay |
AnimancerState |
Stops all other animations on the base layer,
plays the animation registered with the `key`,
and returns the animation's state.
|
TryPlay |
AnimancerState |
Starts fading in the animation registered with the `key`
while fading out all others in the same layer over the course of the `fadeDuration`
and returns the animation's state.
|
TryPlay |
AnimancerState |
Stops all other animations on the base layer,
plays the animation registered with the `key`,
and returns the animation's state.
|
TryPlay |
AnimancerState |
Starts fading in the animation registered with the `key` while fading out all others in the same layer
over the course of the `fadeDuration`. Or if no state is registered with that `key`, this method does
nothing and returns null.
|
Operators
Name | Value | Summary |
---|---|---|
implicit operator |
AnimancerGraph | |
implicit operator |
AnimancerLayer |