Version: 2021.3
Language : English
The Animator Window
State Machine Basics

Animation State Machines

It is common for a character or other animated Game Object to have several different animations for the different actions it performs in a game. For example, a character could breathe or sway slightly when idle, walk when commanded, and raise its arms in panic when it falls from a platform. A door could have animations 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 sequence when 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 Game Object are played.

The following topics provide more details on Mecanim’s state machine: * State Machine Basics * 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 * 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
* Solo and Mute functionality * 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
* Inverse Kinematics

The Animator Window
State Machine Basics