Game Development Reference
In-Depth Information
Excellent! We now have a pair of animations for our player object to use. Now, we
need to set up that animator object so that Mecanim knows how to actually make use
of the animations. Start by selecting the PlayerAnimatorController object in the
Animations/Player folder. If you take a look at the inspector, it looks completely
empty, except in the top-right corner. There's a small Open button. Click on it to
open the Animator Editor tab. You should now be looking at a window that looks
like the following screenshot:
As we previously mentioned, Mecanim reads the animator trees to know how to
play the animations. What we need to do here is build an animation tree. Unity was
nice enough to already add both our animations to the animator for us—we just need
to tell them when to play. To handle this, we will use a simple Boolean check.
At the bottom left, look for the Parameters window. Click on the small + button on
that window and you will see a list of variable types. Choose Bool and a New Bool
variable will be created. Name this Walking . To determine if Mecanim should play
the idle or walking animation, we will use the Walking Boolean.
 
Search WWH ::




Custom Search