Unity Development — Animation
When you are at the point where you are ready to add art to your game, then you are most likely ready to add other extra visual aids as well. A series of images moving in succession is known as animation. It is the heartbeat to the life your new art brings.
Any object can be animated. Unity helps to make this fairly simple. Let’s use one of our new powerups as an example. First, we’ll need the Animation window. You can find that in the Window tab at the top of your screen.
Grab the Animation window tab and place it in a convenient spot in the editor for you. I have mine next to my Console. Once you highlight the object you want to animate in the Hierarchy, the Animation window will automatically as you if you want to create an animator for that object.
You can click on the Create button to get started, but you may want to make a folder in Assets for all your animations first. Once that is done, hit Create and name your first animation based on the object. Ours is just going to be named after the Triple Shot Powerup. Once that is saved, you’ll notice an Animator was automatically added to the object.
The Controller attribute is also filled with a controller that is automatically created as well. We’ll look at that closer in a bit. For now we are going to make our first animation. Hopefully you have found a sprite sheet or a group of sprites that form an animation. Once you have that we can grab them all together and drag them into our Animation window.
It’s done! That is all it really takes. You will most likely want to fine tune it a bit yourself. In that samples section, you can change that number to change the speed of the animation. The higher the fast, the lower the slower.
Let’s go back to that Controller now. Double click it in the Inspector. It should bring up that Animator window for that controller.
If you only have one animation, which is our case, it will be the default animation and will happen automatically. Once you have a full character or enemy with multiple animations, this screen will need a lot more work. For now, enjoy the simplicity.
Go ahead and take a look at your new animation and see how it looks
There you have it. Movement in the art. Your game now has a heartbeat.