Animating Sprites in Unity
As part of the course I am doing; 2D Game Development from GameDevHQ; I was given pre-made sprites, many of which are to use for Animation. It was just a matter of importing these sprites into Unity.
One of those sprites is the speed sprite:
This also came with other sprites to make it seem Animated.
In order to animate the sprites we want too, the first thing we need to do is left click on the object we want to animate (in this case the Speed_Powerup). Then, we need to left click on Window button in the Unity menu, go down to Animation, left click on Animation.
Then we need to left click on create; having a folder called Animations will make it easier for us to locate any Animations we have created. Name the Animation accordingly, then left click on the first sprite of the Animation hold down the shift key and left click on the last sprite of the Animation.
Once all the sprites of the Animation are highlighted, click, hold and drag them into the Animation window. Then we can click on the play button to make sure the Animation is working how we intended.
As can be seen below, since we clicked on the Speed_Powerup prefab before creating an Animation, it now has an Animator component which was automatically added.
Next, in order to make sure any Speed Powerups we spawn have the Animation attached we need to Apply All Overrides to the prefab.