It’s 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 animations for the different actions it performs in a game. For example, a character might breath and sway slightly when idle, walk when commanded, and raise their arms when they fall from a platform. A sliding door might open, close, or jam.
Mecanim uses 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 to arrange these actions. A state machine is a graph of nodes and connecting lines that resembles a flowchart. A state machine plays the animation linked to the current action and determines the next action. You can create a state machine for each character and GameObject in your sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary.
| Topic | Description |
|---|---|
| State machine basics | Learn core state machine concepts and build animation flow in the Animator windowThe window where the Animator Controller is visualized and edited. More info See in Glossary. |
| Animation states | Configure states, motions, and defaults to control what each state plays. |
| 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 |
Control state logic with scriptable parameters. |
| State machine transitions | Simplify complex controllers with Entry and Exit transitions between state machines. |
| 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 |
Blend between states and define when transitions are triggered. |
| Animation blend treesUsed for continuous blending between similar Animation Clips based on float Animation Parameters. More info See in Glossary |
Blend similar motions smoothly using parameters and normalized time. |
| State machine behaviors | Attach behavior scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info See in Glossary to states to run code on enter, update, and exit. |
| Sub-state machines | Group related states into nested machines to keep large graphs manageable. |
| 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 |
Separate animation with layered controllers, masks, and blending modes. |
| State machine solo and mute | Preview transitions faster by soloing key paths and muting irrelevant ones. |
| 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 |
Match character parts to precise world targets during specific animation windows. |