The Animator class is a core component in Unity for managing animations. It works with the Animator Controller to manage states and transitions in a state machine, enabling complex animation setups. This class provides a variety of methods and properties to control animations on GameObjects, essential for dynamic and interactive game environments. Unity's Animator Documentation
Properties
Returns the angular velocity vector of the GameObject. Unity's Animator.angularVelocity Documentation
Controls whether root motion in animations should be applied to the GameObject. Unity's Animator.applyRootMotion Documentation
Refers to the root Transform of the humanoid Avatar in the animator. Unity's Animator.avatarRoot Documentation
Allows getting or setting the position of the body mass. Unity's Animator.bodyPosition Documentation
Lets you get or set the rotation of the body mass. Unity's Animator.bodyRotation Documentation
Returns the GameObject's position change during the last frame. Unity's Animator.deltaPosition Documentation
Provides the rotation difference of the GameObject during the last frame. Unity's Animator.deltaRotation Documentation
A blend variable for calculating the position of each foot during a transition. Unity's Animator.feetPivotActive Documentation
Dictates whether the Animator is allowed to emit events. Unity's Animator.fireEvents Documentation
Represents the gravity weight based on current animations being played. Unity's Animator.gravityWeight Documentation
Indicates whether any playable graphs are attached to the Animator. Unity's Animator.hasBoundPlayables Documentation
Determines if the Animator's animation data contains root motion. Unity's Animator.hasRootMotion Documentation
Indicates if the Animator has a transform hierarchy. Unity's Animator.hasTransformHierarchy Documentation
Provides the scale of the humanoid Avatar in meters. Unity's Animator.humanScale Documentation
Checks if the Animator controls a humanoid model. Unity's Animator.isHuman Documentation
Checks if the Animator is initialized and ready to control animations. Unity's Animator.isInitialized Documentation
Indicates whether the character is currently matching a target via script. Unity's Animator.isMatchingTarget Documentation
Indicates if the Animator can be optimized for performance. Unity's Animator.isOptimizable Documentation
Keeps the current Animator state and its time when the GameObject is disabled. Unity's Animator.keepAnimatorStateOnDisable Documentation
Represents the total number of layers within the Animator. Unity's Animator.layerCount Documentation
Controls whether the mass center is affected by all layers or only the base layer. Unity's Animator.layersAffectMassCenter Documentation
Provides the position of the bottom of the left foot relative to the root. Unity's Animator.leftFeetBottomHeight Documentation
Controls whether warnings are logged for issues with AnimatorController setup. Unity's Animator.logWarnings Documentation
Pertains to the count of parameters in the Animator Controller. Unity's Animator.parameterCount Documentation
Offers the current position of the pivot in the avatar root, relative to world space. Unity's Animator.pivotPosition Documentation
Indicates the current weight of the pivot, as determined by foot animations. Unity's Animator.pivotWeight Documentation
Gets the current playback time of the Animator recorder. Unity's Animator.playbackTime Documentation
Represents the start time of the first frame of the Animator recorder. Unity's Animator.recorderStartTime Documentation
Provides the stop time of the last frame of the Animator recorder. Unity's Animator.recorderStopTime Documentation
Represents the position of the bottom of the right foot relative to the root. Unity's Animator.rightFeetBottomHeight Documentation
Provides the position of the root of the GameObject controlled by the Animator. Unity's Animator.rootPosition Documentation
Offers the rotation of the root of the GameObject controlled by the Animator. Unity's Animator.rootRotation Documentation
Allows manipulation of the Animator's playback speed. Unity's Animator.speed Documentation
Controls feet stabilization for plant and IK feet. Unity's Animator.stabilizeFeet Documentation
Gets the target position for the MatchTarget function. Unity's Animator.targetPosition Documentation
Fetches the target rotation for the MatchTarget function. Unity's Animator.targetRotation Documentation
Gives the velocity vector of the GameObject controlled by the Animator. Unity's Animator.velocity Documentation
Writes default values into the GameObject when the animator component is disabled. Unity's Animator.writeDefaultValuesOnDisable Documentation
Methods
Applies built-in root motion from animation clips, if present. Unity's Animator.ApplyBuiltinRootMotion Documentation
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateHashName
normalizedTransitionDuration
Duration of the transition relative to animation length.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateHashName
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateHashName
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
normalizedTimeOffset
Adjusts the starting point of the transition.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateHashName
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
normalizedTimeOffset
Adjusts the starting point of the transition.
normalizedTransitionTime
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateName
The name of the state.
normalizedTransitionDuration
Duration of the transition relative to animation length.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateName
The name of the state.
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateName
The name of the state.
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
normalizedTimeOffset
Adjusts the starting point of the transition.
Returns
Transitions from the current state to another over a relative duration. Unity's Animator.CrossFade Documentation
Parameters
stateName
The name of the state.
normalizedTransitionDuration
Duration of the transition relative to animation length.
layer
Index of the layer.
normalizedTimeOffset
Adjusts the starting point of the transition.
normalizedTransitionTime
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateHashName
fixedTransitionDuration
The duration of the transition.
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateHashName
fixedTransitionDuration
The duration of the transition.
layer
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateHashName
fixedTransitionDuration
The duration of the transition.
layer
fixedTimeOffset
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateHashName
fixedTransitionDuration
The duration of the transition.
layer
fixedTimeOffset
normalizedTransitionTime
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateName
The name of the state to transition to.
fixedTransitionDuration
The duration of the transition.
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateName
The name of the state to transition to.
fixedTransitionDuration
The duration of the transition.
layer
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateName
The name of the state to transition to.
fixedTransitionDuration
The duration of the transition.
layer
fixedTimeOffset
Returns
Gradually blends from the current animation to another over a fixed time. Unity's Animator.CrossFadeInFixedTime Documentation
Parameters
stateName
The name of the state to transition to.
fixedTransitionDuration
The duration of the transition.
layer
fixedTimeOffset
normalizedTransitionTime
Returns
Retrieves the value of a boolean parameter in the Animator. Unity's Animator.GetBool Documentation
Parameters
id
Returns
The current state (true or false) of the specified parameter.
Retrieves the value of a boolean parameter in the Animator. Unity's Animator.GetBool Documentation
Parameters
name
Name of the parameter.
Returns
The current state (true or false) of the specified parameter.
Returns the count of AnimatorClipInfo instances for the current layer. Unity's Animator.GetCurrentAnimatorClipInfoCount Documentation
Parameters
layerIndex
The index of the layer.
Returns
The count of AnimatorClipInfo instances.
Parameters
layerIndex
Returns
Retrieves a float parameter from the Animator. Unity's Animator.GetFloat Documentation
Parameters
id
Returns
The float value of the specified parameter.
Retrieves a float parameter from the Animator. Unity's Animator.GetFloat Documentation
Parameters
name
The name of the parameter to retrieve.
Returns
The float value of the specified parameter.
Fetches the value of an integer parameter in the Animator. Unity's Animator.GetInteger Documentation
Parameters
id
Returns
The current state of the specified parameter.
Fetches the value of an integer parameter in the Animator. Unity's Animator.GetInteger Documentation
Parameters
name
Name of the parameter.
Returns
The current state of the specified parameter.
Finds the index of a layer by its name. Unity's Animator.GetLayerIndex Documentation
Parameters
layerName
The name of the layer.
Returns
The index of the layer.
Retrieves the name of a layer by its index. Unity's Animator.GetLayerName Documentation
Parameters
layerIndex
The index of the layer.
Returns
The name of the layer.
Gets the weight of a layer, defining its influence on the final animation. Unity's Animator.GetLayerWeight Documentation
Parameters
layerIndex
The index of the layer.
Returns
The weight of the layer.
Gets the count of AnimatorClipInfo for the next layer the animator will transition to. Unity's Animator.GetNextAnimatorClipInfoCount Documentation
Parameters
layerIndex
The index of the layer.
Returns
The count of AnimatorClipInfo instances for the next layer.
Parameters
layerIndex
Returns
Checks if a specific state exists within a layer of the Animator. Unity's Animator.HasState Documentation
Parameters
layerIndex
The index of the layer.
stateID
The ID of the state to check for existence.
Returns
True if the state exists in the specified layer, false otherwise.
Interrupts automatic target matching, allowing manual control. Unity's Animator.InterruptMatchTarget Documentation
Returns
Interrupts automatic target matching, allowing manual control. Unity's Animator.InterruptMatchTarget Documentation
Parameters
completeMatch
Returns
Checks if the animator is in a transition between animations in the state machine. Unity's Animator.IsInTransition Documentation
Parameters
layerIndex
The index of the layer.
Returns
True if the animator is in transition, false otherwise.
Checks if a parameter is controlled by a curve. Unity's Animator.IsParameterControlledByCurve Documentation
Parameters
id
Returns
True if the parameter is controlled by a curve, false otherwise.
Checks if a parameter is controlled by a curve. Unity's Animator.IsParameterControlledByCurve Documentation
Parameters
name
The name of the parameter to check.
Returns
True if the parameter is controlled by a curve, false otherwise.
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateNameHash
Returns
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateNameHash
layer
The layer index.
Returns
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateNameHash
layer
The layer index.
normalizedTime
Returns
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateName
The name of the state.
Returns
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateName
The name of the state.
layer
The layer index.
Returns
Plays an animation state, allowing direct control over animation playback. Unity's Animator.Play Documentation
Parameters
stateName
The name of the state.
layer
The layer index.
normalizedTime
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateNameHash
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateNameHash
layer
The layer index.
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateNameHash
layer
The layer index.
fixedTime
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateName
The name of the state to play.
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateName
The name of the state to play.
layer
The layer index.
Returns
Plays an animation state at a specified time scale, unaffected by Animator speed. Unity's Animator.PlayInFixedTime Documentation
Parameters
stateName
The name of the state to play.
layer
The layer index.
fixedTime
Returns
Resets the Animator to its default state, removing all runtime modifications. Unity's Animator.Rebind Documentation
Returns
Clears a trigger parameter. Unity's Animator.ResetTrigger Documentation
Parameters
id
Returns
Clears a trigger parameter. Unity's Animator.ResetTrigger Documentation
Parameters
name
Name of the trigger parameter to reset.
Returns
Sets the value of a boolean parameter in the Animator. Unity's Animator.SetBool Documentation
Parameters
id
value
The value to be set.
Returns
Sets the value of a boolean parameter in the Animator. Unity's Animator.SetBool Documentation
Parameters
name
Name of the parameter.
value
The value to be set.
Returns
Sets the value of a float parameter. Unity's Animator.SetFloat Documentation
Parameters
id
value
The value to be set.
Returns
Sets the value of a float parameter. Unity's Animator.SetFloat Documentation
Parameters
id
value
The value to be set.
dampTime
deltaTime
Returns
Sets the value of a float parameter. Unity's Animator.SetFloat Documentation
Parameters
name
Name of the parameter.
value
The value to be set.
Returns
Sets the value of a float parameter. Unity's Animator.SetFloat Documentation
Parameters
name
Name of the parameter.
value
The value to be set.
dampTime
deltaTime
Returns
Assigns an integer value to an integer parameter in the Animator. Unity's Animator.SetInteger Documentation
Parameters
id
value
The value to be set.
Returns
Assigns an integer value to an integer parameter in the Animator. Unity's Animator.SetInteger Documentation
Parameters
name
Name of the parameter.
value
The value to be set.
Returns
Sets the weight of a layer, adjusting its influence on the final animation outcome. Unity's Animator.SetLayerWeight Documentation
Parameters
layerIndex
The index of the layer.
weight
The weight to set for the layer.
Returns
Sets a target position for the character's head to look at. Unity's Animator.SetLookAtPosition Documentation
Parameters
lookAtPosition
Position for the character to look at.
Returns
Sets the weights for the head and body parts to look at a position. Unity's Animator.SetLookAtWeight Documentation
Parameters
weight
The weight by which the body parts follow the lookAtPosition.
Returns
Sets the weights for the head and body parts to look at a position. Unity's Animator.SetLookAtWeight Documentation
Parameters
weight
The weight by which the body parts follow the lookAtPosition.
bodyWeight
Returns
Sets the weights for the head and body parts to look at a position. Unity's Animator.SetLookAtWeight Documentation
Parameters
weight
The weight by which the body parts follow the lookAtPosition.
bodyWeight
headWeight
Returns
Sets the weights for the head and body parts to look at a position. Unity's Animator.SetLookAtWeight Documentation
Parameters
weight
The weight by which the body parts follow the lookAtPosition.
bodyWeight
headWeight
eyesWeight
Returns
Sets the weights for the head and body parts to look at a position. Unity's Animator.SetLookAtWeight Documentation
Parameters
weight
The weight by which the body parts follow the lookAtPosition.
bodyWeight
headWeight
eyesWeight
clampWeight
Returns
Activates a trigger parameter to change the animator's state. Unity's Animator.SetTrigger Documentation
Parameters
id
Returns
Activates a trigger parameter to change the animator's state. Unity's Animator.SetTrigger Documentation
Parameters
name
Name of the trigger parameter.
Returns
Begins animator playback mode, useful for testing Animator functionality. Unity's Animator.StartPlayback Documentation
Returns
Starts recording the Animator in play mode for analysis or replaying sequences. Unity's Animator.StartRecording Documentation
Parameters
frameCount
Number of frames to record.
Returns
Stops animator playback mode initiated by StartPlayback. Unity's Animator.StopPlayback Documentation
Returns
Stops recording started by StartRecording, controlling recording duration. Unity's Animator.StopRecording Documentation
Returns
Converts a string into a hash ID for efficient parameter identification. Unity's Animator.StringToHash Documentation
Parameters
name
The string to convert into a hash ID.
Returns
The hash ID of the string.
Manually advances the Animator state machine by a specified amount of time. Unity's Animator.Update Documentation
Parameters
deltaTime
The amount of time to advance the state machine.
Returns
Writes default values to the Animator, resetting runtime modifications. Unity's Animator.WriteDefaultValues Documentation
Returns
Updated 4 days ago