MixerState<TParameter> Class

Summary

[Pro-Only] Base class for mixers which blend an array of child states together based on a Animancer.MixerState`1.Parameter.
graph BT Type-->Base0["ManualMixerState"] click Base0 "/animancer/api/Animancer/ManualMixerState" Base0-->Base1["MixerState"] click Base1 "/animancer/api/Animancer/MixerState" Base1-->Base2["AnimancerState"] click Base2 "/animancer/api/Animancer/AnimancerState" Base2-->Base3["AnimancerNode"] click Base3 "/animancer/api/Animancer/AnimancerNode" Base3-->Base4["Key"] click Base4 "/animancer/api/Animancer/Key" Base4-->Base5["Object"] Type-.->Interface0["IKeyedListItem"] click Interface0 "/animancer/api/Animancer/IKeyedListItem" Type-.->Interface1["IEnumerable<AnimancerState>"] Type-.->Interface2["IEnumerator"] Type-.->Interface3["IPlayableWrapper"] click Interface3 "/animancer/api/Animancer/IPlayableWrapper" Type-.->Interface4["IAnimationClipCollection"] click Interface4 "/animancer/api/Animancer/IAnimationClipCollection" Type["MixerState<TParameter>"] class Type type-node Derived0["DirectionalMixerState"]-->Type click Derived0 "/animancer/api/Animancer/DirectionalMixerState" Derived1["LinearMixerState"]-->Type click Derived1 "/animancer/api/Animancer/LinearMixerState" Derived2["CartesianMixerState"]-->Type click Derived2 "/animancer/api/Animancer/CartesianMixerState"

Syntax

public abstract class MixerState<TParameter> : ManualMixerState, IKeyedListItem, 
    IEnumerable<AnimancerState>, IEnumerator, IPlayableWrapper, IAnimationClipCollection

Remarks

Documentation: Mixers

Type Parameters

Name Description
TParameter

Fields

Name Constant Value Summary
NoParameters
An empty array of parameter values.
static
NoStates
An empty array of states.
Inherited from ManualMixerState
static

Properties

Name Value Summary
ApplyAnimatorIK bool
[Animancer.IHasIK] Determines whether OnAnimatorIK(int layerIndex) will be called on the animated object while this node and its children are active. The initial value is determined by Animancer.AnimancerPlayable.DefaultApplyAnimatorIK.

This is equivalent to the "IK Pass" toggle in Animator Controller layers.

Note that this property only applies to Animancer.ClipStates.
Inherited from AnimancerNode
ApplyFootIK bool
[Animancer.IHasIK] Determines whether this node and its children are applying IK to the character's feet. The initial value is determined by Animancer.AnimancerPlayable.DefaultApplyFootIK.

This is equivalent to the "Foot IK" toggle in Animator Controller states.

Note that this property only applies to Animancer.ClipStates.
Inherited from AnimancerNode
AutoSynchroniseChildren bool
Should newly added children be automatically added to the synchronisation list? Default true.
Inherited from MixerState
static
AverageVelocity Vector3
The average velocity of the root motion caused by this state.
Inherited from MixerState
ChildCount int
Inherited from ManualMixerState
ChildStates IList<AnimancerState>
Returns the Animancer.ManualMixerState._States.
Inherited from ManualMixerState
Clip AnimationClip
A Animancer.MixerState has no UnityEngine.AnimationClip.
Inherited from MixerState
Duration float
The number of seconds the animation will take to play fully at its current Animancer.AnimancerNode.Speed.
Inherited from AnimancerState
EditorName string
[Editor-Only] The Inspector display name of this node.
Inherited from AnimancerNode
EffectiveSpeed float
The Animancer.AnimancerNode.Speed of this node multiplied by the Animancer.AnimancerNode.Speed of each of its parents to determine the actual speed it's playing at.
Inherited from AnimancerNode
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 AnimancerState
EventPoolCapacity int
The capacity of the internal list in the Animancer.ObjectPool`1 for Animancer.AnimancerState.EventRunner.
Inherited from AnimancerState
static
EventPoolCount int
The number of spare items in the Animancer.ObjectPool`1 for Animancer.AnimancerState.EventRunner.
Inherited from AnimancerState
static
Events AnimancerEvent.Sequence
A list of Animancer.AnimancerEvents that will occur while this state plays as well as one that specifically defines when this state ends.

Accessing this property will acquire a spare Animancer.AnimancerEvent.Sequence from the Animancer.ObjectPool if none was already assigned. You can use Animancer.AnimancerState.HasEvents to check beforehand.

Animancer Lite does not allow the use of events in runtime builds, except for .
Inherited from AnimancerState
FadeSpeed float
The speed at which this node is fading towards the Animancer.AnimancerNode.TargetWeight.
Inherited from AnimancerNode
HasEvents bool
Indicates whether this state currently has an Animancer.AnimancerEvent.Sequence (since accessing the Animancer.AnimancerState.Events would automatically get one from the Animancer.ObjectPool).
Inherited from AnimancerState
HasThresholds bool
Indicates whether the array of thresholds has been initialised with a size at least equal to the Animancer.AnimancerNode.ChildCount.
Index int
The index of the port this node is connected to on the parent's UnityEngine.Playables.Playable.
Inherited from AnimancerNode
IsActive bool
Returns true if this state is playing and is at or fading towards a non-zero Animancer.AnimancerNode.Weight.
Inherited from AnimancerState
IsLooping bool
Are any child states looping?
Inherited from MixerState
IsPlaying bool
Are states in this mixer are playing?
Inherited from MixerState
IsStopped bool
Returns true if this state is not playing and is at 0 Animancer.AnimancerNode.Weight.
Inherited from AnimancerState
IsValid bool
Indicates whether the Animancer.AnimancerNode._Playable is usable (properly initialised and not destroyed).
Inherited from AnimancerNode
KeepChildrenConnected bool
Mixers should keep child playables connected to the graph at all times.
Inherited from MixerState
Key Object
The object used to identify this state in the root Animancer.AnimancerPlayable.States dictionary. Can be null.
Inherited from AnimancerState
Layer AnimancerLayer
The root Animancer.AnimancerLayer which this node is connected to.
Inherited from AnimancerState
LayerIndex int
The index of the Animancer.AnimancerLayer this state is connected to (determined by the Animancer.AnimancerState.Parent).
Inherited from AnimancerState
Length float
The weighted average Animancer.AnimancerState.Length of each child state according to their Animancer.AnimancerNode.Weight.
Inherited from MixerState
MainObject Object
The main object to show in the Inspector for this state (if any).
Inherited from AnimancerState
MinimumSynchroniseChildrenWeight float
The minimum total weight of all children for their times to be synchronised (default 0.01).
Inherited from MixerState
static
NormalizedEndTime float
[Pro-Only] The Animancer.AnimancerState.NormalizedTime after which the Animancer.AnimancerEvent.Sequence.OnEnd callback will be invoked every frame.
Inherited from AnimancerState
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.
Inherited from AnimancerState
Parameter TParameter
The value used to calculate the weights of the child states.
ParameterCount int
The number of parameters being managed by this state.
Inherited from MixerState
Parent IPlayableWrapper
The object which receives the output of the UnityEngine.Playables.Playable.
Inherited from AnimancerState
RawTime float
The weighted average Animancer.AnimancerState.Time of each child state according to their Animancer.AnimancerNode.Weight.
Inherited from MixerState
RemainingDuration float
The number of seconds the animation will take to reach the Animancer.AnimancerState.NormalizedEndTime at its current Animancer.AnimancerNode.Speed.
Inherited from AnimancerState
Root AnimancerPlayable
The Animancer.AnimancerPlayable at the root of the graph.
Inherited from AnimancerNode
Speed float
[Pro-Only] How fast the Animancer.AnimancerState.Time is advancing every frame.

1 is the normal speed.

A negative value will play the animation backwards.
Inherited from AnimancerNode
SynchronisedChildCount int
The number of Animancer.MixerState.SynchronisedChildren.
Inherited from MixerState
SynchronisedChildren AnimancerState[]
A copy of the internal list of child states that will have their times synchronised.
Inherited from MixerState
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.
Inherited from AnimancerState
Weight float
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 and values inbetween apply a proportional effect.

Setting this property cancels any fade currently in progress. If you don't wish to do that, you can use Animancer.AnimancerNode.SetWeight(System.Single) instead.

Animancer Lite only allows this value to be set to 0 or 1 in runtime builds.
Inherited from AnimancerNode
WeightsAreDirty bool
Indicates whether the weights of all child states should be recalculated.
Inherited from MixerState

Methods

Name Value Summary
AppendDescription(StringBuilder, int, string) void
Appends a detailed descrption of the current details of this node.
Inherited from AnimancerNode
AppendDetails(StringBuilder, string) void
AppendParameter(StringBuilder, TParameter) void
Appends the `parameter` in a viewer-friendly format.
ApplySynchroniseChildren(bool) void
Synchronises the Animancer.AnimancerState.NormalizedTimes of the Animancer.MixerState.SynchronisedChildren by modifying their internal playable speeds.
Inherited from MixerState
CalculateRealEffectiveSpeed() float
The multiplied UnityEngine.Playables.PlayableExtensions.GetSpeed``1(``0) of this mixer and its parents down the hierarchy to determine the actual speed its output is being played at.
Inherited from MixerState
CalculateThresholds(Func<AnimancerState, TParameter>) void
Calls `calculate` for each of the Animancer.ManualMixerState._States and stores the returned value as the threshold for that state.
CalculateTotalWeight(IList<AnimancerState>) float
Calculates the sum of the Animancer.AnimancerNode.Weight of all `states`.
Inherited from MixerState
CancelSetTime() void
Prevents the Animancer.AnimancerState.RawTime from being applied.
Inherited from AnimancerState
ChangeMainObject<T>(T, T) void
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.
Inherited from AnimancerState
CreateChild(int, AnimationClip) ClipState
Creates and returns a new Animancer.ClipState to play the `clip` with this mixer as its parent.
Inherited from MixerState
CreateChild(int, AnimationClip, TParameter) ClipState
Creates and returns a new Animancer.ClipState to play the `clip` with this Animancer.MixerState as its parent, connects it to the specified `index`, and assigns the `threshold` for it.
CreateChild(int, ITransition) AnimancerState
Calls Animancer.AnimancerUtilities.CreateStateAndApply(Animancer.ITransition,Animancer.AnimancerPlayable) and sets this mixer as the state's parent.
Inherited from MixerState
CreateChild(int, ITransition, TParameter) AnimancerState
Calls Animancer.AnimancerUtilities.CreateStateAndApply(Animancer.ITransition,Animancer.AnimancerPlayable), sets this mixer as the state's parent, and assigns the `threshold` for it.
CreatePlayable() void
Creates and assigns the UnityEngine.Playables.Playable managed by this state.
Inherited from AnimancerState
CreatePlayable(Playable) void
Creates and assigns the UnityEngine.Animations.AnimationMixerPlayable managed by this state.
Inherited from MixerState
CreatePlayable<T>(AnimancerPlayable, T, bool) AnimationScriptPlayable
Creates an AnimationScriptPlayable to run the specified Animation Job instead of the usual UnityEngine.Animations.AnimationMixerPlayable.
Inherited from MixerState
CreatePlayable<T>(Playable, T, bool) void
Creates an AnimationScriptPlayable to run the specified Animation Job instead of the usual UnityEngine.Animations.AnimationMixerPlayable.
Inherited from MixerState
Destroy() void
Destroys the UnityEngine.Playables.Playable and cleans up this state.
Inherited from MixerState
DestroyChildren() void
Destroys all Animancer.MixerState.ChildStates connected to this mixer. This operation cannot be undone.
Inherited from MixerState
DestroyPlayable() void
Destroys the UnityEngine.Playables.Playable.
Inherited from AnimancerNode
DisableRemainingStates(int) void
Sets the weight of all states after the `previousIndex` to 0.
Inherited from MixerState
DontSynchronise(AnimancerState) void
Removes the `state` from the Animancer.MixerState.SynchronisedChildren.
Inherited from MixerState
DontSynchroniseChildren() void
Removes all children of this mixer from the Animancer.MixerState.SynchronisedChildren.
Inherited from MixerState
ForceRecalculateWeights() void
Recalculates the weights of all child states based on the current value of the Animancer.MixerState`1.Parameter and the thresholds.

Overrides of this method must set Animancer.MixerState.WeightsAreDirty = false.
Inherited from MixerState
GatherAnimationClips(ICollection<AnimationClip>) void
[Animancer.IAnimationClipCollection] Gathers all the animations in this state.
Inherited from MixerState
GetChild(int) AnimancerState
Inherited from ManualMixerState
GetDescription(int, string) string
Returns a detailed descrption of the current details of this node.
Inherited from AnimancerNode
GetDisplayKey(AnimancerState) string
Gets a user-friendly key to identify the `state` in the Inspector.
GetEnumerator() IEnumerator<AnimancerState>
Gets an enumerator for all of this node's child states.
Inherited from MixerState
GetJobData<T>() T
Gets the Animation Job data from the AnimationScriptPlayable.
Inherited from MixerState
GetNextState(int) AnimancerState
Returns the state at the specified `index` if it is not null, otherwise increments the index and checks again. Returns null if no state is found by the end of the Animancer.MixerState.ChildStates.
Inherited from MixerState
GetParameterName(int) string
Returns the name of a parameter being managed by this state.
Inherited from MixerState
GetParameterType(int) AnimatorControllerParameterType
Returns the type of a parameter being managed by this state.
Inherited from MixerState
GetParameterValue(int) Object
Returns the value of a parameter being managed by this state.
Inherited from MixerState
GetParentMixer() MixerState
Returns the highest Animancer.MixerState in the hierarchy above this mixer or this mixer itself if there are none above it.
Inherited from MixerState
GetParentMixer(IPlayableWrapper) MixerState
Returns the highest Animancer.MixerState in the hierarchy above the `state` (inclusive).
Inherited from MixerState
static
GetPath() string
Returns the hierarchy path of this state through its Animancer.AnimancerState.Parents.
Inherited from AnimancerState
GetThreshold(int) TParameter
Returns the value of the threshold associated with the specified index.
IndexOf(Key) int
Returns location of this object in the list (or -1 if it is not currently in a keyed list).
Inherited from Key
static
Initialise(AnimationClip[]) void
Initialises this mixer with one state per clip.
Inherited from ManualMixerState
Initialise(AnimationClip[], Func<AnimancerState, TParameter>) void
Initialises the UnityEngine.Animations.AnimationMixerPlayable and Animancer.ManualMixerState._States with one state per clip and assigns the thresholds by calling `calculateThreshold` for each state.
Initialise(AnimationClip[], TParameter[]) void
Initialises the UnityEngine.Animations.AnimationMixerPlayable and Animancer.ManualMixerState._States with one state per clip and assigns the `thresholds`.

WARNING: if you keep a reference to the `thresholds` array, you must call Animancer.MixerState`1.OnThresholdsChanged whenever any changes are made to it, otherwise this mixer may not blend correctly.
Initialise(int) void
Initialises this mixer with the specified number of children which can be set individually by Animancer.MixerState.CreateChild(System.Int32,UnityEngine.AnimationClip) and Animancer.MixerState.SetChild(System.Int32,Animancer.AnimancerState).
InitialiseSynchronisedChildren(bool[]) void
Initialises the internal Animancer.MixerState.SynchronisedChildren list.
Inherited from MixerState
IsChildOf(IPlayableWrapper, IPlayableWrapper) bool
Is the `child` a child of the `parent`?
Inherited from MixerState
static
IsInList(Key) bool
Indicates whether the specified object is currently in a keyed list.
Inherited from Key
static
IsSynchronised(AnimancerState) bool
Is the `state` in the Animancer.MixerState.SynchronisedChildren?
Inherited from MixerState
NormalizeDurations() void
Recalculates the Animancer.AnimancerState.Duration of all child states so that they add up to 1.
Inherited from MixerState
NormalizeWeights(float) void
Divides the weight of all child states by the `totalWeight`.
Inherited from MixerState
OnAddChild(IList<AnimancerState>, AnimancerState) void
Connects the `state` to this node at its Animancer.AnimancerNode.Index.
Inherited from AnimancerNode
OnThresholdsChanged() void
Called whenever the thresholds are changed. By default this method simply indicates that the blend weights need recalculating but it can be overridden by child classes to perform validation checks or optimisations.
Play() void
Plays this state immediately, without any blending.
Inherited from AnimancerState
RecalculateWeights() bool
If Animancer.MixerState.WeightsAreDirty this method recalculates the weights of all child states and returns true.
Inherited from MixerState
RecreatePlayable() void
Stores the values of all parameters, calls Animancer.AnimancerNode.DestroyPlayable, then restores the parameter values.
RecreatePlayableRecursive() void
Calls Animancer.AnimancerNode.RecreatePlayable on this node and all its children recursively.
Inherited from AnimancerNode
RequireUpdate() void
Calls Animancer.AnimancerPlayable.RequireUpdate(Animancer.AnimancerNode) as long as the Animancer.AnimancerNode.Root is not null.
Inherited from AnimancerNode
SetChild(int, AnimancerState) void
Assigns the `state` as a child of this mixer.
Inherited from MixerState
SetChild(int, AnimancerState, TParameter) void
Assigns the `state` as a child of this mixer and assigns the `threshold` for it.
SetChildrenTime(float, bool) void
Sets Animancer.AnimancerState.Time for all Animancer.MixerState.ChildStates.
Inherited from MixerState
SetEditorName(string) void
[Editor-Conditional] Sets the Inspector display name of this node. Animancer.AnimancerNode.ToString returns the name.
Inherited from AnimancerNode
SetJobData<T>(T) void
Sets the Animation Job data in the AnimationScriptPlayable.
Inherited from MixerState
SetMinEventPoolCount(int) void
If the Animancer.AnimancerState.EventPoolCount is less than the specified value, this method increases it to that value by creating new objects.
Inherited from AnimancerState
static
SetParameterValue(int, Object) void
Sets the value of a parameter being managed by this state.
Inherited from MixerState
SetParent(AnimancerNode, int) void
Connects this state to the `parent` mixer at the specified `index`.
Inherited from AnimancerState
SetRoot(AnimancerPlayable) void
The Animancer.AnimancerPlayable at the root of the graph.
Inherited from AnimancerState
SetThreshold(int, TParameter) void
Sets the value of the threshold associated with the specified index.
SetThresholds(TParameter[]) void
Assigns the specified array as the thresholds to use for blending.

WARNING: if you keep a reference to the `thresholds` array you must call Animancer.MixerState`1.OnThresholdsChanged whenever any changes are made to it, otherwise this mixer may not blend correctly.
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.

This method allows any fade currently in progress to continue. If you don't wish to do that, you can set the Animancer.AnimancerNode.Weight property instead.

Animancer Lite only allows this value to be set to 0 or 1 in runtime builds.
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).

If the `targetWeight` is 0 then Animancer.AnimancerNode.Stop will be called when the fade is complete.

If the Animancer.AnimancerNode.Weight is already equal to the `targetWeight` then the fade will end immediately.

Animancer Lite only allows a `targetWeight` of 0 or 1 and the default `fadeDuration` (0.25 seconds) in runtime builds.
Inherited from AnimancerNode
Stop() void
Stops the animation and makes it inactive immediately so it no longer affects the output.
Inherited from AnimancerState
Synchronise(AnimancerState) void
Adds the `state` to the Animancer.MixerState.SynchronisedChildren.
Inherited from MixerState
ToString() string
Returns a string describing the type of this mixer and the name of Animancer.MixerState.Clips connected to it.
Inherited from MixerState
ValidateThresholdCount() bool
If the System.Array.Length of the Animancer.MixerState`1._Thresholds is not equal to the Animancer.AnimancerNode.ChildCount, this method assigns a new array of that size and returns true.

Extension Methods

Name Value Summary
CalculateEditorFadeDuration(float) float
Returns the duration of the `node`s current fade (if any), otherwise returns the `defaultDuration`.
IsValid() bool
Returns true if the `node` is not null and Animancer.AnimancerNode.IsValid.