Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Animator

Namespace: UnityEngine

/

Inherits from: Behaviour

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

Sumbission failed

For some reason your suggested change could not be submitted. Please try again 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.

Variables

angularVelocityGets the avatar angular velocity for the last evaluated frame.
applyRootMotionShould root motion be applied?
avatarGets/Sets the current Avatar.
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. At 0%, the blending point is body center of mass. At 100%, the blending point is feet pivot.
gravityWeightThe current gravity weight based on current animations that are played.
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.
isMatchingTargetIf automatic matching is active.
isOptimizableReturns true if the current rig is optimizable with AnimatorUtility.OptimizeTransformHierarchy.
layerCountThe AnimatorController layer count.
layersAffectMassCenterAdditional layers affects the center of mass.
leftFeetBottomHeightGet left foot bottom height.
linearVelocityBlendingWhen linearVelocityBlending is set to true, the root motion velocity and angular velocity will be blended linearly.
parametersRead only acces to the AnimatorControllerParameters used by the animator.
pivotPositionGet the current position of the pivot.
pivotWeightGets the pivot weight.
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(AvatarTarget targetIndex, float targetNormalizedTime)).
targetRotationReturns the rotation of the target specified by SetTarget(AvatarTarget targetIndex, float targetNormalizedTime)).
updateModeSpecifies the update mode of the Animator.
velocityGets the avatar velocity for the last evaluated frame.

Public Functions

CrossFadeCreate a dynamic transition between the current state and the destination state.
GetAnimatorTransitionInfoGets the Transition information on a specified AnimatorController layer.
GetBehaviourReturn the first StateMachineBehaviour that match type T or derived from T. Return null if none are found.
GetBehavioursReturn all StateMachineBehaviour that match type T or derived from T. Return null if none are found.
GetBoneTransformReturns transform mapped to this human bone id.
GetBoolGets the value of a bool parameter.
GetCurrentAnimatorClipInfoGets the list of AnimatorClipInfo currently played by the current state.
GetCurrentAnimatorStateInfoGets the current State information on a specified AnimatorController layer.
GetFloatGets the value of a 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).
GetIntegerGets the value of an integer parameter.
GetLayerIndexGets the index of the layer with specified name.
GetLayerNameGets name of the layer.
GetLayerWeightGets the layer's current weight.
GetNextAnimatorClipInfoGets the list of AnimatorClipInfo currently played by the next state. Only valid during a transition.
GetNextAnimatorStateInfoGets the next State information on a specified AnimatorController layer.
HasStateReturns true if the AnimatorState is present in the Animator's controller.
InterruptMatchTargetInterrupts the automatic target matching.
IsInTransitionIs the specified AnimatorController layer in a transition.
IsParameterControlledByCurveReturns true if a parameter is controlled by an additional curve on an animation.
MatchTargetAutomatically adjust the gameobject position and rotation so that the AvatarTarget reaches the matchPosition when the current state is at the specified progress.
PlayPlays a state.
RebindRebind all the animated properties and mesh data with the Animator.
ResetTriggerResets the trigger parameter to false.
SetBoolSets the value of a bool parameter.
SetFloatSets the value of a float parameter.
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 an integer parameter.
SetLayerWeightSets the layer's current weight.
SetLookAtPositionSets the look at position.
SetLookAtWeightSet look at weights.
SetTargetSets an AvatarTarget and a targetNormalizedTime for the current state.
SetTriggerSets a trigger parameter to active.
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.

Static Functions

StringToHashGenerates an parameter id from a string.

Inherited members

Variables

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledHas the Behaviour had enabled called.
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 (null if there is none attached).
hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.

Public Functions

BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
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.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

Static Functions

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

Operators

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