Game Development Reference
In-Depth Information
5. Select the newly created
Animations/Player
folder, name the animation
PlayerIdleAnimation
, and click on
Save
.
You now have a blank animation, and you'll notice that a few other changes occurred
as well. First off, in the
Animations
/
Player
folder, there is now a
Player
object
along with
PlayerIdleAnimation
. This player object is actually an Animator
Controller object, which Mecanim uses to know how to animate something; sort of
like a description of dance steps. It is essentially a tree of animations, with certain
requirements that are met to switch between different animations. We'll discuss that
further in a little bit, but to keep things organized, rename the player animator object
to
PlayerAnimatorController
. Now it's clear what it is.
When you click on the player object in the scene
Hierarchy
tab, you'll see that
an
Animator
component has already been attached and the
Controller
field uses
PlayerAnimatorController
. This
Animator
component does all the actual
animation-changing work for the sprite's animations and uses the Animator
Controller fed to it as the guidelines on how to animate.
In the
Animation
tab, you'll now see that
PlayerIdleAnimation
is open. If it's not,
click on the player object in the
Hierarchy
tab and
PlayerIdleAnimation
should
automatically open.
Make sure the
Dope Sheet
button, which you can see circled in the following
screenshot, is clicked on at the bottom of the
Animation
tab: