Animating a Sprite with the 2D Animation Package
Tutorial
·
Beginner
·
+10XP
·
15 mins
·
(307)
Unity Technologies

Once you’ve rigged your Sprite with Unity’s Skinning Editor, the process of animating it is identical to animating any other animateable property in Unity.
Languages available:
1. Animating a Sprite with the 2D Animation Package
Verified in 2019.4
Once you’ve rigged your Sprite with Unity’s Skinning Editor, the process of animating it is identical to animating any other animatable property in Unity.

Figure 01: Plunkah, ready for action.
Drag the rigged Sprite you wish to animate into the Hierarchy view to automatically create a GameObject with a SpriteRenderer, with your Sprite assigned.
With this new GameObject selected in the Hierarchy, press Ctrl + 6 (Command + 6 on a Mac) or select Animation > Animation from the Window drop-down (Figure 02).

Figure 02: Animation menu
Click Create to create an Animation Clip (Figure 03). Give it a name and click Save. The first time you create an Animation Clip for a GameObject, an Animator Controller, named for the currently selected GameObject, will automatically be created and assigned.

Figure 03: Click Create to create your first Animation Clip.
Once you’ve created at least one Animation Clip, you can create more by clicking the name of the current clip in the upper-left corner of the Animation Window and selecting Create New Clip. (Figure 04)

Figure 04: Create New Clip
In the Create New Animation file dialog, choose a location and a name for your new Animation Clip and click Save.
Before you start animating, it’s recommended that you keyframe the position and rotation of all bones at frame 0:00 in their default pose, even if you aren’t planning on animating them. This is to prevent issues if you move or rotate the bones later. Recording mode must be enabled to save keyframes. Click the record button (the red circle) in the upper-left of the Animation window to enable keyframe recording. (Figure 05)

Figure 05: Recording mode is enabled, indicated by the red tint over the record button.
With keyframe recording mode enabled, hold Alt and click the triangle to the left of your GameObject in the Hierarchy. This will automatically expand the full Hierarchy. (Figure 06)

Figure 06: Full bone Hierarchy for Plunkah
Click the Root bone and while holding Shift, click the last bone. (Figure 07)

Figure 07: Bones
With all bones selected, right-click Position in the Transform section of the Inspector and select Add Key (Figure 08). Repeat for Rotation. The Transform and Position lines will be tinted red in the Inspector, indicating that any changes are being recorded as keyframes.
(Figure 09)

Figure 08: Add Key to begin keyframing Position and Rotation

Figure 09: The red tint of the Position and Rotation fields indicate that any changes are being recorded.
At this point, you’re ready to begin animating. You may find it faster to work by keyframing the extremes of your animation poses and rotations, then adding and tweaking in-between keyframes as necessary. To change the current animation frame, drag the time slider.
(Figure 10)

Figure 10: As the time slider is moved, any previously recorded animation will be played back in the Scene view. This is a quick way to “pencil test” animations.
Select the bone you wish to move or rotate in the Hierarchy. Any changes you make to its position or rotation will generate a keyframe on the corresponding property. (Figure 11)

Figure 11: The change in bn_bod_01’s rotation on frame 18 has been automatically recorded as a keyframe.
Once the initial setup is done, animating in Unity is practically automatic.
2. Conclusion
In this tutorial, you learned how to animate a sprite after you have rigged and skinned it using Unity's Skinning Editor. Animating a rigged and skinned sprite is just like animating any other object inside of Unity. You learned how to create a clip for the sprite/character, how to add new animations and how to add keyframes. You are now equipped with the knowledge to bring your 2D characters to life.