Now that we're familiar with the concept of a state machine, let's get our hands dirty and start implementing our very own.
As of Unity 5.0.0f4, state machines are still part of the animation system, but worry not, they are flexible, and no animations are actually required to implement them. Don't be alarmed or confused if you see code referencing the Animator
component or the AnimationController
asset as it's merely a quirk of the current implementation. It's fathomable that Unity will address this in a later version, but the concepts will likely not change.
Let's fire up Unity, create a new project, and get to it.
The
AnimationController
asset is a type of asset within Unity that handles states and transitions. It is, in essence, an FSM, but it also does much more. We'll focus on the FSM portion of its functionality. An animator controller can be created from the Assets menu, as shown in the following image:
Once you create...