Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

Animator

Switch to Manual

Namespace: UnityEngine

/

Inherits from: Behaviour

Description

Interface to control the Mecanim animation system.

Variables

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.
leftFeetBottomHeightGet left foot bottom height.
pivotPositionGet the current position of the pivot.
pivotWeightGets the pivot weight.
playbackTimeSets the playback position in the recording buffer.
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.

Functions

CrossFadeCreate a dynamic transition between the current state and the destination state.
GetAnimatorTransitionInfoGets the Transition information on a specified AnimatorController layer.
GetBoneTransformReturns transform mapped to this human bone id.
GetBoolGets the value of a bool parameter.
GetCurrentAnimationClipStateGets the list of AnimationInfo currently played by the current state.
GetCurrentAnimatorStateInfoGets the current State information on a specified AnimatorController layer.
GetFloatGets the value of a float parameter.
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.
GetLayerNameGets name of the layer.
GetLayerWeightGets the layer's current weight.
GetNextAnimationClipStateGets the list of AnimationInfo currently played by the next state.
GetNextAnimatorStateInfoGets the next State information on a specified AnimatorController layer.
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.
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.
animationThe Animation attached to this GameObject (null if there is none attached).
audioThe AudioSource attached to this GameObject (null if there is none attached).
cameraThe Camera attached to this GameObject (null if there is none attached).
colliderThe Collider attached to this GameObject (null if there is none attached).
collider2DThe Collider2D component attached to the object.
constantForceThe ConstantForce attached to this GameObject (null if there is none attached).
gameObjectThe game object this component is attached to. A component is always attached to a game object.
guiTextThe GUIText attached to this GameObject (null if there is none attached).
guiTextureThe GUITexture attached to this GameObject (Read Only). (null if there is none attached).
hingeJointThe HingeJoint attached to this GameObject (null if there is none attached).
lightThe Light attached to this GameObject (null if there is none attached).
networkViewThe NetworkView attached to this GameObject (Read Only). (null if there is none attached).
particleEmitterThe ParticleEmitter attached to this GameObject (null if there is none attached).
particleSystemThe ParticleSystem attached to this GameObject (null if there is none attached).
rendererThe Renderer attached to this GameObject (null if there is none attached).
rigidbodyThe Rigidbody attached to this GameObject (null if there is none attached).
rigidbody2DThe Rigidbody2D that is attached to the Component's GameObject.
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.

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.