The animation component is used to play back animations.
You can assign animation clips to the animation component and control playback from your script.
The animation system in Unity is weight based and supports: Animation Blending, Additive animations, Animation Mixing, Layers and full control over all aspects of animation playback.
For an overview of Character Animation please read this introduction.
To play a simple animation use Animation.Play
To cross-fade between animations use Animation.CrossFade
To change the layer of an animation use AnimationState.layer
To change how animations wrap (Loop, Once, PingPong) use Animation.wrapMode or AnimationState.wrapMode
AnimationState can be used to modify playback speed and for direct control over blending and mixing.
Animation also supports enumerators so you can loop through all AnimationStates like this:
See Also: An overview of Character animation in unity is here.
The default animation.
Should the default animation clip (Animation.clip) automatically start playing on startup.
How should time beyond the playback range of the clip be treated?
Are we playing any animations?
|this [string name]||
Returns the animation state named name.
When turned on, animations will be executed in the physics loop. This is only useful in conjunction with kinematic rigidbodies.
Stops all playing animations that were started with this Animation.
Rewinds the animation named name.
Samples animations at the current state.
Is the animation named name playing?
Plays the default animation. The animation will be played abruptly without any blending.
Fades the animation with name animation in over a period of time seconds and fades other animations out.
Blends the animation named animation towards targetWeight over the next time seconds.
Cross fades an animation after previous animations has finished playing.
Plays an animation after previous animations has finished playing.
Adds a clip to the animation with name newName.
Remove clip from the animation list.
Get the number of clips currently assigned to this animation
Synchronizes playback speed of all animations in the layer.
Enabled Behaviours are Updated, disabled Behaviours are not.
The game object this component is attached to. A component is always attached to a game object.
The tag of this game object.
The name of the object.
Should the object be hidden, saved with the scene or modifyable by the user?
Returns the component of Type type if the game object has one attached, null if it doesn't.
Returns the component of Type type in the GameObject or any of its children using depth first search.
Returns all components of Type type in the GameObject or any of its children.
Returns all components of Type type in the GameObject.
Is this game object tagged tag?
Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour
Calls the method named methodName on every MonoBehaviour in this game object.
Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
Returns the instance id of the object.
Does the object exist?
Clones the object original and returns the clone.
Removes a gameobject, component or asset.
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
Returns a list of all active loaded objects of Type type.
Returns the first active loaded object of Type type.
Compares if two objects refer to the same
Compares if two objects refer to a different object
Makes the object target not be destroyed automatically when loading a new scene.