Animating Sprites in Unity

Micha Davis
2 min readApr 11, 2021

--

All we need is some uhn-tiss, uhn-tiss, uhn-tiss.

I want powerups for my space shooter game. But not any old ragtag powerup sprites will do. I want eye catching sprites. I want my powerups to look powerful. I want sprites with pizazz. And you can’t get real pizazz with a still image.

Time to animate.

Animation in Unity is a breeze, and your options are pretty powerful. You can script all kinds of conditional events with the animation controller. But for now, let’s focus on getting a simple, continually looping animation for our powerups.

To start, I’ll drag the first frame of my animation into the scene and rename the object “Triple_Shot_Powerup.” I’ll also give it a collider2D, a rigidbody2D, and a Powerup script so I can program the logic for movement and collection later. Finally, I’ll select the powerup in the hierarchy and open the Animation window.

Next I click “Create,” and choose a location and name for my animation clip. Hit “save” and you’ll notice two new objects in your Project view:

The top item is the Animation Controller. It holds the logic (if any) for this animation. It only contains one instruction right now: play the Triple_Shot_Powerup_anim.

The other item is the animation itself. To get the animation going, you’ll hit the red “record” button in the Animation window. Then drag your animation frames into the dopesheet.

Stop the recording and save your work. Press play to see the animation happen. Everything looks good, so we can get the other two powerups set up the same way and then move on to scripting the behavior and logic of our powerups.

In the next article I’ll show you how to set up a flexible modular powerup system.

--

--

Micha Davis

Unity Developer / Game Developer / Artist / Problem Solver