Unity Features: Sprite Animation

This tutorial will walk you through the basics of creating sprite-based animations in Unity. This tutorial assumes you already have created and imported your sprite assets.

Previous Tutorials:

Video Tutorial

Step 1 – Open the Animation window

You can get to this window from the main dropdown menus at the top of the screen. Choose Window > Animation > Animation.

Dock the window somewhere useful – it is a longer window, so I use the area at the bottom of the screen.

Step 2 – Select the GameObject you want to animate

Step 3 – Click “Create” in the Animation window

This will prompt you to save the new animation somewhere. Create or select an Animation folder in your project’s Assets folder, and name your animation based on what it is. Make sure to be descriptive with your naming!

Step 4 – Select the sprites for each frame of this animation

You can select multiple sprites at a time by clicking the first sprite, holding Shift, and clicking the last sprite. Or, if the sprites aren’t in order in your folder, you can click the first sprite in the animation, hold down Ctrl, and click each following sprite in order.

Step 5 – Drag the sprites onto the Animation timeline

The timeline is the right-hand part of the Animation window. This is like a timeline in Adobe Animate or Premier – it shows how the animation will change as time goes on.

Step 6 – Press Play on the Animation window to test the animation

Make sure to use the Play button on the Animation window, not the overall Unity play button. This will allow you to test just this animation, rather than the entire game.

Check your GameObject and see how the animation looks. Chances are the animation might be running a bit too fast!

Step 7 – Alter framerate

You can change the framerate at which this animation is played. This option isn’t visible at first – use the cog at the top right of the Animation window and select Show Sample Rate, then change the Sample Rate to the framerate you want for this animation. If you used Piskel to create the animation, the default framerate for Piskel’s preview is 12, so try that.

Test the animation again to see how your new framerate looks. Keep changing it and testing until you get a framerate you like.

Step 8 – Add more animations

You can add more animations to this object, which you can switch between based on what’s happening in the game. The dropdown menu in the top left of the Animation window shows the animations for this GameObject. You can select “Create new clip” from this dropdown to make a new animation for this GameObject.

Once you’ve created a new blank clip, you can go back to Step 4 to setup the new animation.

Further Reading

  • Unity Features: Puppet Animation
  • Unity Features: Animator (Switching Animations)
  • Playground Pattern: Player Animation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s