Time for action – creating the target state machine
The use of a state machine allows us to focus more on what the target is doing, while letting Unity handle the how it is going to do it part.
Creating an Animator Controller is simple and done just as we have been doing for our scripts and materials. The option is second from the bottom of the Create menu. Create one in the
Targets
folder and name itTargetController
.Double-click on
TargetController
to open a new window.The Animator window is where we edit our state machines.
At the top-left corner of the window, there is a breadcrumb trail as you might find on a website that lets us see where we are in the state machine at a glance.
The Auto Live Link button in the top-right controls our ability to see the state machine's update in real time with the game. This is useful for debugging transitions and controls for the character.
Underneath the breadcrumb trail, there are a list of layers and a button for adding new layers. Every state machine...