In this article, I will provide a step-by-step instructions in animating a Sprite. First, I have Shield power up sprites that when displayed one after another will provide an illusion that it is glowing.
The first step is to drag the first sprite into the Scene.I’ve renamed the object to Shield_Powerup and set the scale to 0.5 for x, y and z.
While Shield_Powerup is selected, Select Window -> Animation -> Animation to open the Animation window. In my case it’s already docked in the bottom half of my screen.
Click the Create button to create an animation. On my end, I will save it as Shield_Powerup_anim.
At this point, an Animator component will be added to Shield_Powerup that has an Animation Controller. This controller is used to manage animations and provide ways of performing single or blended animations via triggers, parameters, and state changes.
If you double-click the controller, you will find that the sequence of events starts in the Entry node and it will transition immediately to the Shield_Powerup_anim animation which is empty at the moment.
Now, you need to press the record button to record, drag the all the sprites for the Shield power up to the Exposure Sheet and finally press the record button again to stop recording.
If you notice, the only property that was added is Shield_Powerup : Sprite which means this is the only property updated in the animation. If you drag the timeline, you can see is the only thing that changed per frame is the sprite that will be displayed on the screen.
Finally, if we take a look at the Triple_Shot_Powerup_Anim asset, we can see that Loop Time is checked. Which means that the animation will loop when it reaches the end of the frame.
To test and verify this to be true, press Play. We can see that the shield power up is animating and the animation is looping.