Create animation for 2D Object

Welcome to our Unity tutorial series.

In this tutorial, we will show you how to make a simple animation for your 2D object.

Animation is very important when making a game, it makes your game become more real and lively and then people will be more interested. Would you like to make a simple animation now? With Unity, it’s quite simple.

If you are ready to start, let us help you by this tutorial.

 First of all, you need to understand the basic knowledge about animation in 2D. For easily, just imagine that animation is just a list of images running continuously. That means you have to create more images for making animation.

We will keep using my last project for this tutorial. For anyone who has not read our previous tutorial yet, you can check it out or download only the project from this link.

In that project, it already has a pacman face with the mount is open, and now, we will add one more image as the pacman’s mouth is close. Just a simple circle like this:



Add this image to Unity. If you don’t know how to do that, please check out this tutorial.


Now we have two sprites like this:


 If your current Unity layout does not containAnimation window, you need to open it by press Ctrl + 6 (on Windows)

Or click Window on menu bar ->Animation


Drag and drop that window to dock it to somewhere like this:


The text showing inside this window is “No animatable object selected.”. That means you have to select an object to make animation for it.

In this case, select the object has name is pacman in Hierarchy window.

Animation window will become like this:


Click on Create to create new animation for current object selected.

We recommend you to create one more folder name Animations for better arrangement.


Select a name for new animation, something like PacmanAnim, then click Save.

This is what we got in Animation window


Notice that the small button with red circle on the top-left of this window is pushed. That means we are recording animation for the object.

We don’t need to concern about any property in this example. Just focus on the right part of this window. You can see there is a row of small numbers on the top. It’s the number of frames. From frame 0 to frame 60 is one second, this is a detail view of 60 frames per second (FPS).

Now let’s drag and drop our images into this window like this:

Drop the pacman face with open mouth to frame 0 and frame 20.

Drop another one to frame 10.

Or you can drop randomly and then drag the small rhombus above each image to modify its position later.


Notice: The lower space between two images, the faster animation that we will get.

Now click on the small triangle next to the red circle to see the demo result.

Now press play button to enter Gameplay mode.If you see the pacman face is opening and closing continuously, that means we are success to make a simple animation.


Thanks for reading and don’t forget to leave us a comment if you got any trouble.


In the next tutorial, we will show you how to make this animation only works when the face is moving. Don’t worry, just a couple lines of code to make it. See you!