AnimancerState Class

Summary

Base class for all states in an Animancer.AnimancerGraph graph which manages one or more UnityEngine.Playables.Playables.
graph BT Type-->Base0["AnimancerNode"] click Base0 "/animancer/api/Animancer/AnimancerNode" Base0-->Base1["AnimancerNodeBase"] click Base1 "/animancer/api/Animancer/AnimancerNodeBase" Base1-->Base2["Object"] Type-.->Interface0["ICopyable<AnimancerNode>"] Type-.->Interface1["IEnumerable<AnimancerState>"] Type-.->Interface2["IEnumerator"] Type-.->Interface3["IHasDescription"] click Interface3 "/animancer/api/Animancer/IHasDescription" Type-.->Interface4["IAnimationClipCollection"] click Interface4 "/animancer/api/Animancer/IAnimationClipCollection" Type-.->Interface5["ICloneable<AnimancerState>"] Type-.->Interface6["ICopyable<AnimancerState>"] Type["AnimancerState"] class Type type-node Derived0["ControllerState"]-->Type click Derived0 "/animancer/api/Animancer/ControllerState" Derived1["ClipState"]-->Type click Derived1 "/animancer/api/Animancer/ClipState" Derived2["PlayableAssetState"]-->Type click Derived2 "/animancer/api/Animancer/PlayableAssetState" Derived3["ManualMixerState"]-->Type click Derived3 "/animancer/api/Animancer/ManualMixerState"

Syntax

public abstract class AnimancerState : AnimancerNode, ICopyable<AnimancerNode>, 
    IEnumerable<AnimancerState>, IEnumerator, IHasDescription, IAnimationClipCollection, 
    ICloneable<AnimancerState>, ICopyable<AnimancerState>

Remarks

This class can be used as a custom yield instruction to wait until the animation either stops playing or reaches its end.

Documentation: States

Properties

Name Value Summary
ApplyAnimatorIK bool
Should Unity call OnAnimatorIK on the animated object while this object and its children have any Animancer.AnimancerNode.Weight?
Inherited from AnimancerNode
ApplyFootIK bool
Should this object and its children apply IK to the character's feet?
Inherited from AnimancerNode
ApplyParentAnimatorIK bool
Should setting the Animancer.AnimancerNodeBase.Parent also set this node's Animancer.AnimancerNode.ApplyAnimatorIK to match it? Default is true.
Inherited from AnimancerNode
static
ApplyParentFootIK bool
Should setting the Animancer.AnimancerNodeBase.Parent also set this node's Animancer.AnimancerNode.ApplyFootIK to match it? Default is true.
Inherited from AnimancerNode
static
AverageVelocity Vector3
The average velocity of the Root Motion caused by this state.
ChildCount int
The number of nodes using this as their Animancer.AnimancerNodeBase.Parent.
Inherited from AnimancerNodeBase
Clip AnimationClip
The UnityEngine.AnimationClip which this state plays (if any).
DebugName Object
[Assert-Only] The Inspector display name of this node.
Inherited from AnimancerNode
Duration float
The number of seconds the animation will take to play fully at its current Animancer.AnimancerNodeBase.EffectiveSpeed.
EffectiveSpeed float
The Animancer.AnimancerNodeBase.Speed of this node multiplied by the Animancer.AnimancerNodeBase.Speed of each of its parents to determine the actual speed it's playing at.
Inherited from AnimancerNodeBase
EffectiveWeight float
The Animancer.AnimancerNode.Weight of this state multiplied by the Animancer.AnimancerNode.Weight of each of its parents down the hierarchy to determine how much this state affects the final output.
Inherited from AnimancerNode
FadeGroup FadeGroup
The current fade being applied to this node (if any).
Inherited from AnimancerNode
FadeSpeed float
The speed at which this node is fading towards the Animancer.AnimancerNode.TargetWeight.
Inherited from AnimancerNode
Graph AnimancerGraph
The Animancer.AnimancerGraph containing this node.
Inherited from AnimancerNodeBase
HasEvents bool
Have the Animancer.AnimancerState.SharedEvents or Animancer.AnimancerState.OwnedEvents been initialized?
HasOwnedEvents bool
Have the Animancer.AnimancerState.OwnedEvents been initialized?
Index int
The index of the port this node is connected to on the parent's UnityEngine.Playables.Playable.
Inherited from AnimancerNode
IsActive bool
Is this state currently updating or affecting the animation output?
IsCurrent bool
Is this state playing and not fading out?
IsLooping bool
Will this state loop back to the start when it reaches the end?
IsPlaying bool
Is the Animancer.AnimancerState.Time automatically advancing?
IsStopped bool
Is this state not playing and at 0 Animancer.AnimancerNode.Weight?
KeepChildrenConnected bool
Should child playables stay connected to the graph at all times?
Inherited from AnimancerNodeBase
Key Object
The object used to identify this state in the graph Animancer.AnimancerGraph.States dictionary. Can be null.
Layer AnimancerLayer
The root Animancer.AnimancerLayer which this node is connected to (if any).
Inherited from AnimancerNodeBase
LayerIndex int
The index of the Animancer.AnimancerLayer this state is connected to (determined by the Animancer.AnimancerNodeBase.Parent).
Length float
The total time this state would take to play in seconds when Animancer.AnimancerNodeBase.Speed = 1.
MainObject Object
The main object to show in the Inspector for this state (if any).
MainObjectType Type
[Editor-Only] The base type which can be assigned to the Animancer.AnimancerState.MainObject.
NormalizedEndTime float
The Animancer.AnimancerState.NormalizedTime after which the Animancer.AnimancerEvent.Sequence.OnEnd callback will be invoked every frame.
NormalizedTime float
The Animancer.AnimancerState.Time of this state as a portion of the animation's Animancer.AnimancerState.Length, meaning the value goes from 0 to 1 as it plays from start to end, regardless of how long that actually takes.
NormalizedTimeD double
The underlying double value of Animancer.AnimancerState.NormalizedTime.
OwnedEvents AnimancerEvent.Sequence
Events which will be triggered while this state plays based on its Animancer.AnimancerState.NormalizedTime.
Owner Object
[Assert-Only] An optional reference to the object that owns this state.
Parent AnimancerNodeBase
The object which receives the output of the Animancer.AnimancerNodeBase.Playable.
Inherited from AnimancerNodeBase
Playable Playable
The internal object this node manages in the UnityEngine.Playables.PlayableGraph.
Inherited from AnimancerNodeBase
RaiseEventsDuringFadeOut bool
Should events be raised on a state which is currently fading out?
static
RawTime double
The internal implementation of Animancer.AnimancerState.Time which directly gets and sets the underlying value.
RemainingDuration float
The number of seconds this state will take to go from its current Animancer.AnimancerState.NormalizedTime to the Animancer.AnimancerState.NormalizedEndTime at its current Animancer.AnimancerNodeBase.EffectiveSpeed.
SharedEvents AnimancerEvent.Sequence
Events which will be triggered while this state plays based on its Animancer.AnimancerState.NormalizedTime.
Speed float
[Pro-Only] How fast the Animancer.AnimancerState.Time is advancing every frame (default 1).
Inherited from AnimancerNodeBase
TargetWeight float
The desired Animancer.AnimancerNode.Weight which this node is fading towards according to the Animancer.AnimancerNode.FadeSpeed.
Inherited from AnimancerNode
Time float
The number of seconds that have passed since the start of this animation.
TimeD double
The underlying double value of Animancer.AnimancerState.Time.
TraceConstructor bool
[Assert-Only] Should a System.Diagnostics.StackTrace be captured in the constructor of all new nodes so Animancer.OptionalWarning.UnusedNode can include it in the warning if that node ends up being unused?
Inherited from AnimancerNode
static
Weight float
The current blend weight of this node which determines how much it affects the final output.
Inherited from AnimancerNode

Methods

Name Value Summary
~AnimancerNode() void
[Assert-Only] Checks Animancer.OptionalWarning.UnusedNode.
Inherited from AnimancerNode
AddContextMenuIK(GenericMenu, AnimancerNodeBase) void
[Editor-Only] Adds functions to show and set Animancer.AnimancerNodeBase.ApplyAnimatorIK and Animancer.AnimancerNodeBase.ApplyFootIK.
Inherited from AnimancerNodeBase
static
AppendDescription(StringBuilder, string) void
Appends a detailed descrption of the current details of this object.
Inherited from AnimancerNode
AppendDetails(StringBuilder, string) void
Called by Animancer.AnimancerNode.AppendDescription(System.Text.StringBuilder,System.String) to append the details of this node.
AppendIKDetails(StringBuilder, string, AnimancerNodeBase) void
Appends the details of Animancer.AnimancerNodeBase.ApplyAnimatorIK and Animancer.AnimancerNodeBase.ApplyFootIK.
Inherited from AnimancerNode
static
AssertConnectionStatus() void
[Assert-Only] Calls Animancer.AnimancerNode.GetConnectionStatusError and logs the result if it isn't null.
Inherited from AnimancerNode
AssertConnectionStatusRecursive(AnimancerNodeBase) void
[Assert-Only] Calls Animancer.AnimancerNode.AssertConnectionStatus for the `node` and all of its children.
Inherited from AnimancerNode
static
AssertOwnership(Object) void
[Assert-Conditional] Sets the Animancer.AnimancerState.Owner and asserts that it wasn't already set to a different object.
CancelFade() void
Removes this node from the Animancer.AnimancerNode.FadeGroup.
Inherited from AnimancerNode
ChangeMainObject<T>(T, T) bool
Sets the `currentObject` and calls Animancer.AnimancerNode.RecreatePlayable. If the `currentObject` was being used as the Animancer.AnimancerState.Key then it is changed as well.
Clone(CloneContext) AnimancerState
Creates a new object with the same type and values this.
CopyFrom(AnimancerNode, CloneContext) void
Copies the details of `copyFrom` into this node, replacing its previous contents.
CopyFrom(AnimancerState, CloneContext) void
Copies the contents of `copyFrom` into this object, replacing its previous contents.
CopyIKFlags(AnimancerNodeBase) void
Copies the IK settings from `copyFrom` into this node:
  • If is true, copy .
  • If is true, copy .
Inherited from AnimancerNode
CreatePlayable() void
Creates and assigns the UnityEngine.Playables.Playable managed by this state.
CreatePlayable(Playable) void
Creates and assigns the UnityEngine.Playables.Playable managed by this node.
Inherited from AnimancerNode
Destroy() void
Destroys the UnityEngine.Playables.Playable and cleans up this state.
DestroyPlayable() void
Destroys the UnityEngine.Playables.Playable.
Inherited from AnimancerNode
DisconnectChildSafe(int) void
Disconnects the UnityEngine.Playables.Playable of the child at the specified `index` from this node.
Inherited from AnimancerNode
Events(Object) AnimancerEvent.Sequence
If the Animancer.AnimancerState.OwnedEvents haven't been initialized yet, this method gets them and returns true.
Events(Object, AnimancerEvent.Sequence) bool
If the Animancer.AnimancerState.OwnedEvents haven't been initialized yet, this method gets them and returns true.
GatherAnimationClips(ICollection<AnimationClip>) void
[Animancer.IAnimationClipCollection] Gathers all the animations in this state.
GetChild(int) AnimancerState
Returns the state connected to the specified `index` as a child of this node.
Inherited from AnimancerNode
GetConnectionStatusError() string
Returns null if this node is properly connected to its parent. Otherwise, returns an error message to be logged.
GetConstructorStackTrace(AnimancerNode) StackTrace
[Assert-Only] Returns the stack trace of the constructor (or null if Animancer.AnimancerNode.TraceConstructor was false).
Inherited from AnimancerNode
static
GetEnumerator() FastEnumerator<AnimancerState>
Gets an enumerator for all of this node's child states.
Inherited from AnimancerNode
GetEventDispatchInfo(float, float, bool) void
Gets the details used to trigger Animancer.AnimancerEvents on this state: Animancer.AnimancerState.Length, Animancer.AnimancerState.NormalizedTime, and Animancer.AnimancerState.IsLooping.
GetPath() string
Returns the hierarchy path of this node through its Animancer.AnimancerNodeBase.Parents.
Inherited from AnimancerNode
IsPlayingAndNotEnding() bool
Returns true if the animation is playing and has not yet passed the Animancer.AnimancerEvent.Sequence.EndEvent.
MarkAsUsed(AnimancerNodeBase) void
[Assert-Conditional] Prevents the `node` from causing Animancer.OptionalWarning.UnusedNode.
Inherited from AnimancerNodeBase
static
MoveTime(double, bool) void
Sets the Animancer.AnimancerState.Time or Animancer.AnimancerState.NormalizedTime, but unlike those properties this method doesn't skip Events or Root Motion between the old and new time.
MoveTime(float, bool) void
Sets the Animancer.AnimancerState.Time or Animancer.AnimancerState.NormalizedTime, but unlike those properties this method doesn't skip Events or Root Motion between the old and new time.
OnChildIsLoopingChanged(bool) void
Called when a child's Animancer.AnimancerState.IsLooping value changes.
Inherited from AnimancerNodeBase
OnSetIsPlaying() void
Called when the value of Animancer.AnimancerState.IsPlaying is changed.
Play() void
Plays this state immediately, without any blending and without affecting any other states.
RecreatePlayable() void
Calls Animancer.AnimancerNode.DestroyPlayable and Animancer.AnimancerNode.CreatePlayable.
Inherited from AnimancerNode
RecreatePlayableRecursive() void
Calls Animancer.AnimancerNode.RecreatePlayable on this node and all its children recursively.
Inherited from AnimancerNode
SetDebugName(Object) void
[Assert-Conditional] Sets the Animancer.AnimancerNode.DebugName to display in the Inspector.
Inherited from AnimancerNode
SetExpectFade(AnimancerState, float) void
[Internal] Sets a flag for Animancer.OptionalWarning.ExpectFade.
static
SetGraph(AnimancerGraph) void
Sets the Animancer.AnimancerNodeBase.Graph.
SetParent(AnimancerNode) void
Connects this state to the `parent` at its next available child index.
SetWeight(float) void
Sets the current blend weight of this node which determines how much it affects the final output. 0 has no effect while 1 applies the full effect of this node.
StartFade(float) void
Calls Animancer.AnimancerNode.OnStartFade and starts fading the Animancer.AnimancerNode.Weight over the course of the Animancer.AnimancerGraph.DefaultFadeDuration (in seconds).
Inherited from AnimancerNode
StartFade(float, float) void
Calls Animancer.AnimancerNode.OnStartFade and starts fading the Animancer.AnimancerNode.Weight over the course of the `fadeDuration` (in seconds).
Inherited from AnimancerNode
Stop() void
Stops the animation and makes it inactive immediately so it no longer affects the output.
Inherited from AnimancerNode
ToString() string
Returns the Animancer.AnimancerNode.DebugName if one is set, otherwise a string describing the type of this state and the name of the Animancer.AnimancerState.MainObject.
UpdateEventsRecursive(AnimancerState) void
Checks if any events should be invoked on the `parent` and its children recursively.
static
UpdateEventsRecursive(AnimancerState, bool) void
Checks if any events should be invoked on the `parent` and its children recursively.
static

Extension Methods

Name Value Summary
CalculateEditorFadeDuration(float) float
[Animancer Extension] [Editor-Only] Returns the duration of the `node`s current fade (if any), otherwise returns the `defaultDuration`.
IsValid() bool
[Animancer Extension] Is the `node` is not null and its Animancer.AnimancerNodeBase.Playable valid?