Defining Animator transitions
Last updated
Last updated
You can use the Animator controller to control how an object transitions between different animation clips. This requires an Animator component on the object for which you want to control animations. When you use the Animation Window to add animations to an object in Unity, an Animator component is added automatically. For more detailed information, refer to the Animation Controller page in the Unity documentation.
A transition defines when the Animator should change from one animation clip to another. To add a transition, complete the following steps:
In the Hierarchy panel, select the object that you want to define transitions for.
From the Window menu, select Animation > Animator.
Optional: To set the default state, right-click an animation, and then select Set as Layer Default State from the menu that appears.
Complete the following steps for each transition that you want to create:
Right-click the animation that you want to transition from, and then select Make Transition from the menu that appears.
Select the animation that you want to transition to.
When the Animator plays an animation clip that has a transition, it will automatically follow that transition after the animation clip finishes playing. If you want to control when the Animator will follow a transition, one option is to use triggers. See the following section for more information.
If you add a trigger to a transition, the Animator will follow the transition only when the trigger has been activated. After a trigger has caused a transition to be followed, the trigger is reset.
To create a trigger and apply it to a transition, complete the following steps:
In the Animator, select the Parameters tab.
From the plus menu, select Trigger.
Enter a name for the trigger.
In the Animator canvas, select the transition that you want to trigger.
In the Inspector panel, in the Conditions list, select the plus symbol.
From the list that is added, select the trigger that you want to activate the transition.
When Unity is in play mode, you can access the Animator panel, and then select triggers to test the transitions.