Animating a Sprite with Unity’s Animation Window

Dennisse Pagán Dávila
CodeX
Published in
3 min readApr 21, 2021

Sprite Animations are clips made specifically for two-dimensional assets. They can be made in a variety of different ways, one of them is through the usage of keyframe animation in Unity’s Animation window. Keyframes are points on the continuum of an Animation Clip that provide information about the GameObject, such as its Transform details. These keyframes denote a transition or change in the data in order to create an animation. To play the animation, Unity interpolates the data from one keyframe to the next.

How to create a sprite keyframe animation

  1. To open the Animation Window, go to the Window menu, select Animation. Dock the Animation window in a comfortable position for your editor. If you want to learn how to make your Unity Editor more productive in 3 simple steps, check this out!

2. Select a Sprite from the Hierarchy. Once your Sprite is selected, click on Create, and give the animation an appropriate name.

A good naming convention to keep in mind is to use an underscore followed by the word “anim” so that it’s easier to locate animation when necessary.

Note: The icon above your newly created animation in the Project view is known as the Animation Controller. You don’t need to worry about that right now, but I have provided a link so that you can familiarize yourself with the concept.

3. Unity employs Automatic Keyframing, which means that any movement added to the GameObject in the Scene view will be captured in the animation once Animation Mode is active. To begin making keyframes, click the Record button in the Animation window.

Note: The Playhead is the white line in the Animation Timeline that shows when a keyframe will be inserted. Simply left-click and drag the Playhead to the correct frame if necessary.

4. Now, we can actually record the movement of our Sprite. This can be done by simply moving your Sprite or gameObject in the Scene view using the Move tool. When you do this, a keyframe recording the movement will be inserted where the Playhead is.

If you have been provided with or have a Sprite set already, the process is a simple as dragging and dropping the set into the Animation Window.

5. Once you are done recording, you can press the record button to stop registering Keyframes. If you used the drag-and-drop method, there is no need to press the record button at any given time but it is best practice to do so.

In the next article, we’ll take a look at how to determine the length of a power-up’s effect!

--

--

Dennisse Pagán Dávila
CodeX
Writer for

Software Engineer that specialize in Game Development. Currently looking for new opportunities. LinkedIn: https://rb.gy/xdu8nu