Unity – Animation component: Animating your 2D character

In this blog i will show you how to create an animation for your 2D character.

Preparing your 2D Sprite

In a previously blog we explain how to use the Srite Editor. Go to the next link to see it. Prepare A 2D Tileset For Pixelart In Unity

Move your sprite to animate in to the hierarchy

Move your 2D sprite from the asset folder in to the hierarchy, after do that, you will see your sprite in the scene window.

Adding the Animation component to your sprite

With your sprite selected, go to “add component” (in the bottom). Search for Animation and Click.

Set the Animation window

If you don’t see the Animation window, please follow the next steps.

Go to to the upper part of Unity and click on window. After that, go to the option Animation and then again in animation.

This will open the Animation window and you can relocated in the position of your preference, in the example I let it next to the Game window.

Animating your 2D sprite

Good work!!

Now is time to create a folder (in the example I named it “Animations”) and save your file in that folder.

Don’t forget to change the name of the file.

Little description of the Animation window

Perfect!! Now let’s see what we find in the Animation window:

In yellow : you can change your current animation just with a click

In red: you can add properties to your sprite like modifications in the transform component, changes in the color and more

In blue: you can add events to your animation. For example when your character attack it can be trigger in a specific moment of the animation

In white: click on it to see a preview of your animation.

In green: that is the space to add your keyframes that in other words are the differents poses of your character.

Moving your sprites to your animation window

From your asset folder, move the others poses of your character to the animation window

To do that in a rapid way hold shift and click in your first and last pose, with this you will select all the sprites between these two.

Adjust the time among the keyframes

Now you can move your keyframes in the animation window and select the time that will be needed to complete all the animation.

It’s done!!!

That is all!!!

Thanks for reading

If you find this blog useful let us a comment, and follow us in our instagram @tortugamedev and twitter @Totuas2.

Leave a Comment

Your email address will not be published.