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-v7-4/api/Animancer/IAnimancerComponent"
Type-.->Interface1["IEnumerator"]
Type-.->Interface2["IAnimationClipSource"]
Type-.->Interface3["IAnimationClipCollection"]
click Interface3 "/animancer-v7-4/api/Animancer/IAnimationClipCollection"
Type["AnimancerComponent"]
class Type type-node
Derived0["NamedAnimancerComponent"]-->Type
click Derived0 "/animancer-v7-4/api/Animancer/NamedAnimancerComponent"
Syntax
[AddComponentMenu(Strings.MenuPrefix + "Animancer Component")]
[HelpURL(Strings.DocsURLs.APIDocumentation + "/" + nameof(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.AnimancerPlayable
to an
UnityEngine.Animator
.
Documentation: Component Types
Attributes
Type | Description |
---|---|
AddComponentMenu | |
HelpURLAttribute | |
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 ]
The UnityEngine.Animator component which this script controls.
|
InitialUpdateMode | Nullable |
[Editor-Only] The
Animancer.IAnimancerComponent.UpdateMode that was first used when this script initialized. |
Is |
bool |
Indicates whether the
Animancer.AnimancerComponent.Playable has been initialized. |
Layers | AnimancerPlayable |
The layers which each manage their own set of animations.
|
Playable | AnimancerPlayable |
The internal system which manages the playing animations.
Accessing this property will automatically initialize it.
|
States | AnimancerPlayable |
The states managed by this component.
|
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.AnimancerPlayable 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.Playable .
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.
|
InitializePlayable |
void |
Creates and initializes the
Animancer.AnimancerComponent.Playable if it wasn't already initialized. |
InitializePlayable |
void |
Sets the
Animancer.AnimancerComponent.Playable 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.Playable is properly cleaned up. |
OnDisable |
void |
Acts according to the
Animancer.AnimancerComponent.ActionOnDisable . |
OnEnable |
void |
Ensures that the
UnityEngine.Playables.PlayableGraph is playing. |
OnInitializePlayable |
void |
Called right after the
Animancer.AnimancerComponent.Playable 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.Playable 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 Animancer.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 same layer, plays the animation registered with the `key`, and returns
that state. Or if no state is registered with that `key`, this method does nothing and returns null.
|
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 |
AnimancerLayer | |
implicit operator |
AnimancerPlayable |