Objective: Add animations to our Power Ups.
Animating sprites adds an amazing visual effect to your game. With Unity, it is easy to add animations to your 2D sprites. I will guide you through the process. First, you need to have your 2D sprite sliced up into multiple images, each a little different, as shown below. When searching of game assets, just make sure the animations are included.
Now that we have the sprite spliced up, we can add the animation to the game object. This is done by:
- Moving the prefab to the scene view and highlighting it
- Click on window, then animation, then animation. This will open the animation window
- Click on create animation, give the animation a name, then click save
- In the animation, window click on the record button (the red circle) to start the recording
- Highlight all the slices of the sprite and drag it to the animation window. Then click the record button to stop the recording.
That is it, now the animation is attached to the game object.
The last thing to do is in the inspector, click on the overrides and save the changes to the prefab.