Animating Sprites in Unity

Simon Pham
3 min readJun 30, 2023

In the previous blog post (Day 12), we made the triple-shot power-up and gave it some cool behavior. Now, let’s dive into animating the triple-shot power-up!

Here, I’ve got a sequence of sprites lined up to create our animation.

So, the first step is to double-click on the triple-shot prefab, and then go to Window > Animation > Animation. This action will open up an animation window that you can dock right next to the Console tab.

Next, hit the “Create” button and give our animation a name like “TripleShotPowerUp_anim,” then click “Save.”

This will generate a dope sheet where we can set up our keyframe animation.

To start creating the animation, double-click the TripleShotPowerUp prefab, press the record button in the dope sheet, and select the first frame of the triple shot, hold down the shift key, choose the last frame to select all the frames. Now, drag and drop them into the dope sheet. You can hit the play button to preview the animation and use the record button again to stop it.

Once you’re finished, you’ll notice that there’s a TripleShotPowerUp_anim file and a TripleShotPowerUp controller which will come in handy when you want to control the animation logic for more complex animations.

If you select the TripleShotPowerUp prefab, you’ll see that Unity has already added an Animator component with the animation controller attached to it.

Now, when you drop the prefab into the Hierarchy, set the speed to 0 (so we can observe the animation), and start the game, you’ll see the animation playing. In the animation controller, you can spot the looping (indicated by the blue bar), which is Unity’s default setting.

Great! Our animation is working smoothly.