Version: 2022.3
LanguageEnglish
  • C#

Animator

class in UnityEngine

/

Inherits from:Behaviour

/

Implemented in:UnityEngine.AnimationModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

Interface to control the Mecanim animation system.

Properties

angularVelocityGets the avatar angular velocity for the last evaluated frame.
applyRootMotionShould root motion be applied?
avatarGets/Sets the current Avatar.
avatarRootReturns the Avatar root Transform.
bodyPositionThe position of the body center of mass.
bodyRotationThe rotation of the body center of mass.
cullingModeControls culling of this Animator component.
deltaPositionGets the avatar delta position for the last evaluated frame.
deltaRotationGets the avatar delta rotation for the last evaluated frame.
feetPivotActiveBlends pivot point between body center of mass and feet pivot.
fireEventsSets whether the Animator sends events of type AnimationEvent.
gravityWeightThe current gravity weight based on current animations that are played.
hasBoundPlayablesReturns true if Animator has any playables assigned to it.
hasRootMotionReturns true if the current rig has root motion.
hasTransformHierarchyReturns true if the object has a transform hierarchy.
humanScaleReturns the scale of the current Avatar for a humanoid rig, (1 by default if the rig is generic).
isHumanReturns true if the current rig is humanoid, false if it is generic.
isInitializedReturns whether the animator is initialized successfully.
isMatchingTargetIf automatic matching is active.
isOptimizableReturns true if the current rig is optimizable with AnimatorUtility.OptimizeTransformHierarchy.
keepAnimatorStateOnDisableControls the behaviour of the Animator component when a GameObject is disabled.
layerCountReturns the number of layers in the controller.
layersAffectMassCenterAdditional layers affects the center of mass.
leftFeetBottomHeightGet left foot bottom height.
parameterCountReturns the number of parameters in the controller.
parametersThe AnimatorControllerParameter list used by the animator. (Read Only)
pivotPositionGet the current position of the pivot.
pivotWeightGets the pivot weight.
playableGraphThe PlayableGraph created by the Animator.
playbackTimeSets the playback position in the recording buffer.
recorderModeGets the mode of the Animator recorder.
recorderStartTimeStart time of the first frame of the buffer relative to the frame at which StartRecording was called.
recorderStopTimeEnd time of the recorded clip relative to when StartRecording was called.
rightFeetBottomHeightGet right foot bottom height.
rootPositionThe root position, the position of the game object.
rootRotationThe root rotation, the rotation of the game object.
runtimeAnimatorControllerThe runtime representation of AnimatorController that controls the Animator.
speedThe playback speed of the Animator. 1 is normal playback speed.
stabilizeFeetAutomatic stabilization of feet during transition and blending.
targetPositionReturns the position of the target specified by SetTarget.
targetRotationReturns the rotation of the target specified by SetTarget.
updateModeSpecifies the update mode of the Animator.
velocityGets the avatar velocity for the last evaluated frame.
writeDefaultValuesOnDisableSpecifies whether playable graph values are reset or preserved when the Animator is disabled.

Public Methods

ApplyBuiltinRootMotionApply the default Root Motion.
CrossFadeCreates a crossfade from the current state to any other state using normalized times.
CrossFadeInFixedTimeCreates a crossfade from the current state to any other state using times in seconds.
GetAnimatorTransitionInfoReturns an AnimatorTransitionInfo with the informations on the current transition.
GetBehaviourReturns the first StateMachineBehaviour that matches type T or is derived from T. Returns null if none are found.
GetBehavioursReturns all StateMachineBehaviour that match type T or are derived from T. Returns null if none are found.
GetBoneTransformRetrieves the Transform mapped to a human bone based on its id.
GetBoolReturns the value of the given boolean parameter.
GetCurrentAnimatorClipInfoReturns an array of all the AnimatorClipInfo in the current state of the given layer.
GetCurrentAnimatorClipInfoCountReturns the number of AnimatorClipInfo in the current state.
GetCurrentAnimatorStateInfoReturns an AnimatorStateInfo with the information on the current state.
GetFloatReturns the value of the given float parameter.
GetIKHintPositionGets the position of an IK hint.
GetIKHintPositionWeightGets the translative weight of an IK Hint (0 = at the original animation before IK, 1 = at the hint).
GetIKPositionGets the position of an IK goal.
GetIKPositionWeightGets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal).
GetIKRotationGets the rotation of an IK goal.
GetIKRotationWeightGets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal).
GetIntegerReturns the value of the given integer parameter.
GetLayerIndexReturns the index of the layer with the given name.
GetLayerNameReturns the layer name.
GetLayerWeightReturns the weight of the layer at the specified index.
GetNextAnimatorClipInfoReturns an array of all the AnimatorClipInfo in the next state of the given layer.
GetNextAnimatorClipInfoCountReturns the number of AnimatorClipInfo in the next state.
GetNextAnimatorStateInfoReturns an AnimatorStateInfo with the information on the next state.
GetParameterSee AnimatorController.parameters.
HasStateReturns true if the state exists in this layer, false otherwise.
InterruptMatchTargetInterrupts the automatic target matching.
IsInTransitionReturns true if there is a transition on the given layer, false otherwise.
IsParameterControlledByCurveReturns true if the parameter is controlled by a curve, false otherwise.
MatchTargetAutomatically adjust the GameObject position and rotation.
PlayPlays a state.
PlayInFixedTimePlays a state.
RebindRebind all the animated properties and mesh data with the Animator.
ResetTriggerResets the value of the given trigger parameter.
SetBoneLocalRotationSets local rotation of a human bone during a IK pass.
SetBoolSets the value of the given boolean parameter.
SetFloatSend float values to the Animator to affect transitions.
SetIKHintPositionSets the position of an IK hint.
SetIKHintPositionWeightSets the translative weight of an IK hint (0 = at the original animation before IK, 1 = at the hint).
SetIKPositionSets the position of an IK goal.
SetIKPositionWeightSets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal).
SetIKRotationSets the rotation of an IK goal.
SetIKRotationWeightSets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal).
SetIntegerSets the value of the given integer parameter.
SetLayerWeightSets the weight of the layer at the given index.
SetLookAtPositionSets the look at position.
SetLookAtWeightSet look at weights.
SetTargetSets an AvatarTarget and a targetNormalizedTime for the current state.
SetTriggerSets the value of the given trigger parameter.
StartPlaybackSets the animator in playback mode.
StartRecordingSets the animator in recording mode, and allocates a circular buffer of size frameCount.
StopPlaybackStops the animator playback mode. When playback stops, the avatar resumes getting control from game logic.
StopRecordingStops animator record mode.
UpdateEvaluates the animator based on deltaTime.
WriteDefaultValuesForces a write of the default values stored in the animator.

Static Methods

StringToHashGenerates an parameter id from a string.

Inherited Members

Properties

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledReports whether a GameObject and its associated Behaviour is active and enabled.
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public Methods

BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagChecks the GameObject's tag against the defined tag.
GetComponentGets a reference to a component of type T on the same GameObject as the component specified.
GetComponentInChildrenGets a reference to a component of type T on the same GameObject as the component specified, or any child of the GameObject.
GetComponentIndexGets the index of the component on its parent GameObject.
GetComponentInParentGets a reference to a component of type T on the same GameObject as the component specified, or any parent of the GameObject.
GetComponentsGets references to all components of type T on the same GameObject as the component specified.
GetComponentsInChildrenGets references to all components of type T on the same GameObject as the component specified, and any child of the GameObject.
GetComponentsInParentGets references to all components of type T on the same GameObject as the component specified, and any parent of the GameObject.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
TryGetComponentGets the component of the specified type, if it exists.
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static Methods

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.

Operators

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.