Animation State Machine
It is common for a character or a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary to have several different animations for the different actions it performs in a game. For example, a character breathes and sways slightly when idle, walks when commanded, and raises their arms when they fall from a platform. A door has animations for when it opens, closes, jams, and when it gets broken open.
Mecanim uses a visual layout system, similar to a flowchart, to represent a state machineThe set of states in an Animator Controller that a character or animated GameObject can be in, along with a set of transitions between those states and a variable to remember the current state. The states available will depend on the type of gameplay, but typical states include things like idling, walking, running and jumping. More info
See in Glossary. You use this visual layout system to control and arrange when to play the animation clipsAnimation data that can be used for animated characters or simple animations. It is a simple “unit” piece of motion, such as (one specific instance of) “Idle”, “Walk” or “Run”. More info
See in Glossary for your character or GameObject.
The following topics provide more details on Mecanim’s state machine:
- State Machine Basics
- Animation States
- Animation ParametersUsed to communicate between scripting and the Animator Controller. Some parameters can be set in scripting and used by the controller, while other parameters are based on Custom Curves in Animation Clips and can be sampled using the scripting API. More info
See in Glossary
- State Machine Transitions
- Animation TransitionsAllows a state machine to switch or blend from one animation state to another. Transitions define how long a blend between states should take, and the conditions that activate them. More info
See in Glossary
- Animation Blend TreesUsed for continuous blending between similar Animation Clips based on float Animation Parameters. More info
See in Glossary
- State Machine BehavioursA script that attaches to a state within a state machine to control what happens when the state machine enters, exits or remains within a state, such as play sounds as states are entered. More info
See in Glossary
- Sub-State Machines
- Animation LayersAn Animation Layer contains an Animation State Machine that controls animations of a model or part of it. An example of this is if you have a full-body layer for walking or jumping and a higher layer for upper-body motions such as throwing an object or shooting. The higher layers take precedence for the body parts they control. More info
See in Glossary
- State Machine Solo and Mute
- Target MatchingA scripting function that allows you to move characters in such a way that a hand or foot lands in a certain place at a certain time. For example, the character may need to jump across stepping stones or jump and grab an overhead beam. More info
See in Glossary