AnimancerUtilities Class

Summary

Various extension methods and utilities.
Assembly
Animancer.dll
Namespace
Animancer
Base Types
  • Object
graph BT Type-->Base0["Object"] Type["AnimancerUtilities"] class Type type-node

Syntax

public static class AnimancerUtilities

Methods

Name Value Summary
AddAnimancerComponent<T>(Animator) T
[Animancer Extension] Adds the specified type of Animancer.IAnimancerComponent, links it to the `animator`, and returns it.
static
CalculateThresholdsFromAverageVelocityXZ(MixerState<Vector2>) void
[Pro-Only] Calculates all thresholds in the `mixer` using the Animancer.AnimancerState.AverageVelocity of each state on the X and Z axes.

Note that this method requires the Root Transform Position (XZ) -> Bake Into Pose toggle to be disabled in the Import Settings of each UnityEngine.AnimationClip in the mixer.
static
CreateNativeReference<T>() NativeArray<T>
Creates a Unity.Collections.NativeArray`1 containing a single element so that it can be used like a reference in Unity's C# Job system which does not allow regular reference types.

Note that you must call Unity.Collections.NativeArray`1.Dispose when you are done with the array.
static
CreateStateAndApply(ITransition, AnimancerPlayable) AnimancerState
Calls Animancer.ITransition.CreateState and Animancer.ITransition.Apply(Animancer.AnimancerState).
static
EditModePlay(IAnimancerComponent, AnimationClip, bool) void
[Editor-Conditional] Plays the specified `clip` if called in Edit Mode and optionally pauses it immediately.
static
Gather(ICollection<AnimationClip>, AnimationClip) void
[Animancer Extension] Adds the `clip` to the `clips` if it wasn't there already.
static
Gather(ICollection<AnimationClip>, IEnumerable<AnimationClip>) void
[Animancer Extension] Calls Animancer.AnimancerUtilities.Gather(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},UnityEngine.AnimationClip) for each of the `newClips`.
static
Gather(ICollection<AnimationClip>, IList<AnimationClip>) void
[Animancer Extension] Calls Animancer.AnimancerUtilities.Gather(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},UnityEngine.AnimationClip) for each of the `newClips`.
static
GatherFromAsset(ICollection<AnimationClip>, PlayableAsset) void
[Animancer Extension] Calls Animancer.AnimancerUtilities.Gather(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},UnityEngine.AnimationClip) for each clip in the `asset`.
static
GatherFromSource(ICollection<AnimationClip>, IAnimationClipSource) void
[Animancer Extension] Calls Animancer.AnimancerUtilities.Gather(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},UnityEngine.AnimationClip) for each clip gathered by IAnimationClipSource.GetAnimationClips.
static
GatherFromSource(ICollection<AnimationClip>, Object) bool
[Animancer Extension] Calls Animancer.AnimancerUtilities.Gather(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},UnityEngine.AnimationClip) for each clip in the `source`, supporting both IAnimationClipSource and Animancer.IAnimationClipCollection.
static
GatherFromSources(ICollection<AnimationClip>, IList) void
[Animancer Extension] Calls Animancer.AnimancerUtilities.GatherFromSource(System.Collections.Generic.ICollection{UnityEngine.AnimationClip},System.Object) for each of the `sources`.
static
GetOrAddAnimancerComponent<T>(Animator) T
[Animancer Extension] Returns the Animancer.IAnimancerComponent on the same UnityEngine.GameObject as the `animator` if there is one. Otherwise this method adds a new one and returns it.
static
GetParameterValue(Animator, AnimatorControllerParameter) Object
Gets the value of the `parameter` in the `animator`.
static
GetParameterValue(AnimatorControllerPlayable, AnimatorControllerParameter) Object
Gets the value of the `parameter` in the `playable`.
static
HasEvent(AnimationClip, string) bool
Checks if the `clip` has an animation event with the specified `functionName`.
static
HasEvent(IAnimationClipCollection, string) bool
Checks if any UnityEngine.AnimationClip in the `source` has an animation event with the specified `functionName`.
static
IfMultiComponentThenChangeType<T>(T) void
[Editor-Conditional] If there are multiple components which inherit from T, the first one is changed to the type of the second and any after the first are destroyed. This allows you to change the type without losing the values of any serialized fields they share.

The `currentComponent` is used to determine which UnityEngine.GameObject to examine and the base component type T.
static
IsFinite(float) bool
[Animancer Extension] Returns true as long as the `value` is not NaN or Infinity.
static
IsValid(AnimancerNode) bool
Returns true if the `node` is not null and Animancer.AnimancerNode.IsValid.
static
IsValid(ITransitionDetailed) bool
Returns true if the `node` is not null and Animancer.ITransitionDetailed.IsValid.
static
RemovePlayable(Playable, bool) void
[Pro-Only] Reconnects the input of the specified `playable` to its output.
static
SetDirty(Object) void
[Editor-Conditional] Indicates that the `target` needs to be re-serialized.
static
SetParameterValue(Animator, AnimatorControllerParameter, Object) void
Sets the `value` of the `parameter` in the `animator`.
static
SetParameterValue(AnimatorControllerPlayable, AnimatorControllerParameter, Object) void
Sets the `value` of the `parameter` in the `playable`.
static
Swap<T>(T[], int, int) void
[Animancer Extension] Swaps array[a] with array[b].
static
ToStringOrNull(Object) string
If `obj` exists, this method returns System.Object.ToString. Or if it is null, this method returns "null". Or if it is an UnityEngine.Object that has been destroyed, this method returns "Null (ObjectType)".
static
Wrap01(float) float
[Animancer Extension] Loops the `value` so that 0 <= value < 1.
static