Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

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

applyRootMotion Should root motion be applied?
avatar Gets/Sets the current Avatar.
bodyPosition The position of the body center of mass.
bodyRotation The rotation of the body center of mass.
cullingMode Controls culling of this Animator component.
deltaPosition Gets the avatar delta position for the last evaluated frame.
deltaRotation Gets the avatar delta rotation for the last evaluated frame.
feetPivotActive Blends 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.
gravityWeight The current gravity weight based on current animations that are played.
hasRootMotion Returns true if the current rig has root motion.
hasTransformHierarchy Returns true if the object has a transform hierarchy.
humanScale Returns the scale of the current Avatar for a humanoid rig, (1 by default if the rig is generic).
isHuman Returns true if the current rig is humanoid, false if it is generic.
isMatchingTarget If automatic matching is active.
isOptimizable Returns true if the current rig is optimizable with AnimatorUtility.OptimizeTransformHierarchy.
layerCount The AnimatorController layer count.
leftFeetBottomHeight Get left foot bottom height.
pivotPosition Get the current position of the pivot.
pivotWeight Gets the pivot weight.
playbackTime Sets the playback position in the recording buffer.
recorderStartTime Start time of the first frame of the buffer relative to the frame at which StartRecording was called.
recorderStopTime End time of the recorded clip relative to when StartRecording was called.
rightFeetBottomHeight Get right foot bottom height.
rootPosition The root position, the position of the game object.
rootRotation The root rotation, the rotation of the game object.
runtimeAnimatorController The runtime representation of AnimatorController that controls the Animator.
speed The playback speed of the Animator. 1 is normal playback speed.
stabilizeFeet Automatic stabilization of feet during transition and blending.
targetPosition Returns the position of the target specified by SetTarget(AvatarTarget targetIndex, float targetNormalizedTime)).
targetRotation Returns the rotation of the target specified by SetTarget(AvatarTarget targetIndex, float targetNormalizedTime)).
updateMode Specifies the update mode of the Animator.

Functions

CrossFade Create a dynamic transition between the current state and the destination state.
GetAnimatorTransitionInfo Gets the Transition information on a specified AnimatorController layer.
GetBoneTransform Returns transform mapped to this human bone id.
GetBool Gets the value of a bool parameter.
GetCurrentAnimationClipState Gets the list of AnimationInfo currently played by the current state.
GetCurrentAnimatorStateInfo Gets the current State information on a specified AnimatorController layer.
GetFloat Gets the value of a float parameter.
GetIKPosition Gets the position of an IK goal.
GetIKPositionWeight Gets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal).
GetIKRotation Gets the rotation of an IK goal.
GetIKRotationWeight Gets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal).
GetInteger Gets the value of an integer parameter.
GetLayerName Gets name of the layer.
GetLayerWeight Gets the layer's current weight.
GetNextAnimationClipState Gets the list of AnimationInfo currently played by the next state.
GetNextAnimatorStateInfo Gets the next State information on a specified AnimatorController layer.
InterruptMatchTarget Interrupts the automatic target matching.
IsInTransition Is the specified AnimatorController layer in a transition.
IsParameterControlledByCurve Returns true if a parameter is controlled by an additional curve on an animation.
MatchTarget Automatically adjust the gameobject position and rotation so that the AvatarTarget reaches the matchPosition when the current state is at the specified progress.
Play Plays a state.
Rebind Rebind all the animated properties and mesh data with the Animator.
ResetTrigger Resets the trigger parameter to false.
SetBool Sets the value of a bool parameter.
SetFloat Sets the value of a float parameter.
SetIKPosition Sets the position of an IK goal.
SetIKPositionWeight Sets the translative weight of an IK goal (0 = at the original animation before IK, 1 = at the goal).
SetIKRotation Sets the rotation of an IK goal.
SetIKRotationWeight Sets the rotational weight of an IK goal (0 = rotation before IK, 1 = rotation at the IK goal).
SetInteger Sets the value of an integer parameter.
SetLayerWeight Sets the layer's current weight.
SetLookAtPosition Sets the look at position.
SetLookAtWeight Set look at weights.
SetTarget Sets an AvatarTarget and a targetNormalizedTime for the current state.
SetTrigger Sets a trigger parameter to active.
StartPlayback Sets the animator in playback mode.
StartRecording Sets the animator in recording mode, and allocates a circular buffer of size frameCount.
StopPlayback Stops the animator playback mode. When playback stops, the avatar resumes getting control from game logic.
StopRecording Stops animator record mode.
Update Evaluates the animator based on deltaTime.

Static Functions

StringToHash Generates an parameter id from a string.

Inherited members

Variables

enabled Enabled Behaviours are Updated, disabled Behaviours are not.
animation The Animation attached to this GameObject (null if there is none attached).
audio The AudioSource attached to this GameObject (null if there is none attached).
camera The Camera attached to this GameObject (null if there is none attached).
collider The Collider attached to this GameObject (null if there is none attached).
collider2D The Collider2D component attached to the object.
constantForce The ConstantForce attached to this GameObject (null if there is none attached).
gameObject The game object this component is attached to. A component is always attached to a game object.
guiText The GUIText attached to this GameObject (null if there is none attached).
guiTexture The GUITexture attached to this GameObject (Read Only). (null if there is none attached).
hingeJoint The HingeJoint attached to this GameObject (null if there is none attached).
light The Light attached to this GameObject (null if there is none attached).
networkView The NetworkView attached to this GameObject (Read Only). (null if there is none attached).
particleEmitter The ParticleEmitter attached to this GameObject (null if there is none attached).
particleSystem The ParticleSystem attached to this GameObject (null if there is none attached).
renderer The Renderer attached to this GameObject (null if there is none attached).
rigidbody The Rigidbody attached to this GameObject (null if there is none attached).
rigidbody2D The Rigidbody2D that is attached to the Component's GameObject.
tag The tag of this game object.
transform The Transform attached to this GameObject (null if there is none attached).
hideFlags Should the object be hidden, saved with the scene or modifiable by the user?
name The name of the object.

Functions

BroadcastMessage Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTag Is this game object tagged with /tag/?
GetComponent Returns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildren Returns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParent Returns the component of Type type in the GameObject or any of its parents.
GetComponents Returns all components of Type type in the GameObject.
GetComponentsInChildren Returns all components of Type type in the GameObject or any of its children.
GetComponentsInParent Returns all components of Type type in the GameObject or any of its parents.
SendMessage Calls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwards Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceID Returns the instance id of the object.
ToString Returns the name of the game object.

Static Functions

Destroy Removes a gameobject, component or asset.
DestroyImmediate Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoad Makes the object target not be destroyed automatically when loading a new scene.
FindObjectOfType Returns the first active loaded object of Type type.
FindObjectsOfType Returns a list of all active loaded objects of Type type.
Instantiate Clones the object original and returns the clone.

Operators

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