O'Reilly logo

Mastering Unity 2D Game Development by Simon Jackson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Putting it together

So far, our hero can move to the left and right of the screen, but it is a little flat. As we have some animation in our spritesheet, let's put that into action.

As described earlier, in order to get the animation running, we will need the following prerequisites:

  • An Animator component in our game object
  • An Animator controller to manage our animation that is bound to the animator
  • At least one animation clip to play in the controller

Setting up the animation controller

To get started, first we need to add the Animator component to the player's game object by navigating to Add Component | Miscellaneous | Animator in the Inspector pane. Leave all the other options alone for now.

Next, create a new animation Controller in Assets/Animation/Controllers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required