Day 18: Animated Sprites in Unity

Blake Zoeckler
3 min readMay 7, 2021

Animation is a very important tool to utilize when making a game. It brings life to otherwise static objects and allows players to be immersed on a much greater level than before. Thankfully, Unity makes it very easy to create animations, especially for the 2D objects that we have been using so far.

First we have to add the Animation window to the layout. We can find using the toolbar at the top of the screen (Window -> Animation -> Animation)

Now we select the Triple_Shot_Powerup object in the scene, and create a new animation for it.

We can now setup the frames of the animation. Here we select the first sprite, hold shift, and select the last sprite. Then just drag it into the Animation window. Each sprite will become a keyframe in the animation.

Now we can test the animation by pressing the play button in the Animation window. Looks pretty good!

Some stuff was added automatically when we created this new animation. An Animator component was added to the powerup, with an Animator Controller as well. Unity uses these to keep track of what animations an object has and when they should be played.

When we double click one of these, it opens an Animator window that shows the status of the animations attached to this game object. Here we can see Entry and an arrow pointing to the newly created Triple_Shot_Powerup animation. This means that when the game starts, the animation state will automatically move to that new animation and play it.

We can even see it work when the game runs. Very flashy!

Unity makes it this easy to animate sprites. Just by having a bundle of them in the right order, we can easily make new animation clips for anything we want.

--

--

Blake Zoeckler

I’m a passionate and talented software engineer seeking an opportunity in game development.