Class
FlexMotionLayer

Summary

Syntax

public class FlexMotionLayer

Fields

Name Field Type Summary
BlendPositions float[]
The array of corresponding blend positions for each animation clip. Used for 1D blending. Not used if the layer has only one animation clip.
BlendRange Vector2
The start and end range used during blending. For 1D blending, this value is ignored if the Blend Positions has been set.

Properties

Name Property Type Summary
AngularVelocity Vector3
Get the root motion angular velocity of the animations played by that layer. Should be typically accessed from an OnAnimatorMove callback.
ClipCount int
The number of AnimationClips being played by the FlexMotionLayer.
CurrentState FlexMotionLayer.State
The state of the FlexMotionLayer.
IsInPose bool
Determines if the FlexMotionLayer is currently posing. Posing a layer can be seen as a pause that doesn't prevent transitions to occur.
IsInTransition bool
Checks the current state of the layer to determine if it's in or out transition.
IsMirror bool
Determines whether or not the pose should be mirrored.
IsPaused bool
Determines if the underlying FlexMotionMaskLayer is paused or not. It's important to note that if paused, transitions will be paused as well.
IsPlaying bool
Determines whether the FlexMotionLayer is playing (including transitions).
Length float
The scaled length in seconds of the longest AnimationClip.
NormalizedTime float
Computes the current animation progress ratio using the longest AnimationClip. The returns value is not clamped and will eventually be above 1.0f even if the clip doesn't loop.
Speed float
The speed multiplier of the Layer.
Time float
Gets the layer's current animation time.
UnscaledLength float
The unscaled length in seconds of the FlexMotionLayer based on the longest AnimationClip.
UseWeightedLengths bool
Should the layer recompute every clip speed value using their weights? This will be done every frame to achieve a consistent length.
Velocity Vector3
Get the root motion velocity of the animations played by that layer. Should be typically accessed from an OnAnimatorMove callback.
Weight float
The weight of the motion layer used for blending.

Methods

Name Return Value Summary
ClearRootMotion() FlexMotionLayer
Clear root motion data by reapplying the current time to the playable.
Compute1dBlendWeight(float) void
Computes 1D blend weights based on the given value and previously provided blend positions.
Compute2dBlendWeight(Vector2) void
Computes 2D blend weights based on the given value.
ComputeAveragedLengths(int) FlexMotionLayer
Ensures that the AnimationClips have the same playback length by computing the speed of their respective AnimationClipPlayable using the average clip length.
ComputeNormalized1dBlendWeight(float) void
Computes 1D blend weights based on the given value.
DeleteAnimationJob(AnimationScriptPlayable) void
Delete the AnimationScriptPlayable from a previously inserted animation job.
GetAnimationAsset() object
The reference to the FlexMotion or AnimationClip asset that was lastly used on that layer. An inactive layer will still reference its last used asset.
GetAnimationClip() AnimationClip
Determines the currently shown animation clip based on the layer's weights. Playing an animation clip or a FlexMotion asset with only one clip will skip the weight check.
InsertAnimationJob<T>(T) AnimationScriptPlayable
Insert an Animation Job that will only affect that animation layer. This will create an AnimationScriptPlayable and insert it into the PlayableGraph.
IsReusable(object) bool
Determines if the layer is reusable without having to create and connect new Playables.
OnComplete(FlexMotionLayer.FlexMotionLayerEventHandler) FlexMotionLayer
Subscribes a callback to the completed event which is triggered when the time crosses the current length. The callback will be invoked once per loop even if the animation is visually not looping. Please consider using OnComplete<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnComplete<T>(T, Action<T, FlexMotionLayer>) FlexMotionLayer
Register a callback that will be invoked when the time crosses the current length. The callback will be invoked once per loop even if the animation is visually not looping.
OnNormalizedTime(float, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked once when the provided normalized time is reached. Please consider using OnNormalizedTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnNormalizedTime(float, bool, bool, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached. Please consider using OnNormalizedTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnNormalizedTime<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked once when the provided normalized time is reached.
OnNormalizedTime<T>(T, float, bool, bool, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached.
OnNormalizedTimeLoop(float, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached. The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...). Please consider using OnNormalizedTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnNormalizedTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached. The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
OnNormalizedTimeRepeat(float, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached. The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...). Please consider using OnNormalizedTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnNormalizedTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided normalized time is reached. The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
OnStopped(FlexMotionLayer.FlexMotionLayerEventHandler) FlexMotionLayer
Subscribes a callback to the stopped event which is triggered when the layer starts its "out" transition. Please consider using OnStopped<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnStopped<T>(T, Action<T, FlexMotionLayer>) FlexMotionLayer
Register a callback that will be invoked when the layer starts its "out" transition.
OnTime(float, Action<FlexMotionLayer>, bool, bool) FlexMotionLayer
Registers a callback that will be invoked once when the provided time is reached. Please consider using OnTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnTime(float, bool, bool, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached. Please consider using OnTime<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnTime<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked once when the provided time is reached.
OnTime<T>(T, float, bool, bool, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached.
OnTimeLoop(float, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached. The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...). Please consider using OnTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnTimeLoop<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached. The process will be repeated for every subsequent loop (e.g.: 0.25 => 1.25 => 2.25...).
OnTimeRepeat(float, Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached. The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...). Please consider using OnTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnTimeRepeat<T>(T, float, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked when the provided time is reached. The process will be repeated for every subsequent added target time (e.g.: 0.25 => 0.50 => 0.75...).
OnUpdate(Action<FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked once every update. Please consider using OnUpdate<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
OnUpdate<T>(T, Action<T, FlexMotionLayer>) FlexMotionLayer
Registers a callback that will be invoked once every update.
Pause() void
Pause the the underlying FlexMotionMaskLayer. It's important to note that if paused, transitions will be paused as well.
Play() void

Play the layer, starting its in transition.

ResetClipLengths() FlexMotionLayer
Re-initializes the speed of every AnimationClipPlayables to 1f. Thus the animation clips will have their original lengths restored. Only useful to revert the effect of the method EqualizeClipsLength.
RestoreDefaultSettings() FlexMotionLayer
Restores all the settings to their default values as if the FlexMotionLayer has just been created or reused.
SetApplyFootIK(bool) FlexMotionLayer
Sets the foot IK on or off for all AnimationClips.
SetApplyPlayableIK(bool) FlexMotionLayer
Sets the playable IK on or off for all AnimationClips. Setting it to turn enables the usage of the OnAnimatorIk messages in MonoBehavior scripts.
SetBlendPositions(float[]) FlexMotionLayer
Sets the array of corresponding blend positions for each animation clip. Used for 1D blending. Not used if the layer has only one animation clip.
SetBlendRange(Vector2) FlexMotionLayer
Sets the start and end range used during blending. For 1D blending, this value is ignored if the Blend Positions has been set.
SetBlendWeight(int, float) FlexMotionLayer
Changes the blending weight value of an animation clip based on its index. Obviously this has no effect on layers containing only one animation clip.
SetFrameTime(int) FlexMotionLayer
Sets the layer's current animation frame time. Every animation clip will be affected. The computation is based on the animation clip with the highest weight. As retrieving the AnimationClip from a playable is slow, avoid using this method in an update loop.
SetIsMirror(bool) FlexMotionLayer
Sets if the pose should be mirrored or not.
SetNormalizedTime(float) FlexMotionLayer
Sets the layer's current animation normalized time (from 0f to 1f). Every animation clip will be affected.
SetPose(float) FlexMotionLayer
Sets the layer to a pose by pausing it and applying a normalized time on every animation clips. The normalized time to apply on the animation clips.
SetSpeed(float) FlexMotionLayer
Sets the speed multiplier of the Layer.
SetTime(float) FlexMotionLayer
Sets the layer's current animation time (in seconds). Every animation clip will be affected.
SetTransition(FlexMotionTransition) FlexMotionLayer
Sets the transition to apply when the FlexMotionLayer transitions from one state to another. If that layer is currently in a in transition, the other layers in a out transition will also use that new transition settings. Not doing so will lead to disjointed transitions as it the time and weights will not match.
SetTransitionEasing(Easing.Functions) FlexMotionLayer
Sets the easing function to use during the transition. It will impacts current and future transitions for every layers on the same mask layer.
SetTransitionTime(float) FlexMotionLayer
Sets the duration of the transition. It will impacts current and future transitions for every layers on the same mask layer.
SetUseWeightedLengths(bool) FlexMotionLayer
Should the layer recompute every clip speed value using their weights? This will be done every frame to achieve a consistent length.
SkipTransition() FlexMotionLayer
Skips the current transition for every motion layers on the same mask layer. Do nothing if no transition is currently occuring.
Stop() void

Stops the layer, starting its out transition.

SwitchPause() void
Switches the pause state of the underlying FlexMotionMaskLayer. If it's currently playing, this method will pause it. If it is paused, calling the method will unpause it. It's important to note that if paused, transitions will be paused as well.
SwitchPose() void
Switches the pose state. It can be used as a pause that doesn't impact transitions.
Unpause() void
Unpause the the underlying FlexMotionMaskLayer if it was paused.

Events

Name Type Summary
Completed FlexMotionLayer.FlexMotionLayerEventHandler
Event that is signalled when the FlexMotionLayer motion time crosses its current length. You don't need to manually unsubscribe from this event. Please consider using OnComplete<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.
Stopped FlexMotionLayer.FlexMotionLayerEventHandler
Event that is signalled when the FlexMotionLayer has been stopped thus starting its out transition. You don't need to manually unsubscribe from this event. Please consider using OnStopped<T>(T, Action<T, FlexMotionLayer>) instead to prevent possible closure allocations.