Animating 2D objects in Unity (Game Dev Day 17)
We have added our sprites to our various objects, but right now they don’t actually have any animations attached to them. We are going to add a Powerup system to our game to give it some more depth, so lets go ahead and animate the powerup pickups!
Fortunately Unity makes 2D animation importing a breeze. First, we drag our the first frame of the sprite animation, and use that to make our GameObject
Now we can see that this gameobject has a Sprite renderer applied with the first frame our the animation we are going to be making.
So next we will make the actual animation. Open up your Animation window in Unity (Look under the Window Tab at the top to find it).
Select the GameObject you want to animate in your Hierarchy. Your animation window will look like this.
Create your animation’s name and save location by clicking the “Create” button.
Next, grab the animation frames you want and select them all. Drag them from your Project Folder to the Animation Window.
Now our object looks like this!