Inserting animations in Unity is a simple process and really helps your Game come to life!
First, you will want to drag first frame of the animation into the hierarchy to make it a Game Object.
You will need to add the Animation window to the Unity Editor. Then, select the Game Object you would like to make an animation and in the Animation window click on Create. This is going to prompt you to save the Animation to your Game Files. In keeping things organized, create a new folder to store all of your animations for the game in the Assets folder and name your animation after the Game Object with the addition of _anim. This suffix will help you search through all of the game files when more are added.
Once you have the animation file saved, you will need to record the animation. Hit the record button in the animation tab to enter record mode. The animation for this sprite is already precut (separated into individual frames). If this is the case, you will just have to select all of the sliced sprites and drag them into the animation timeline (while it is still recording) and it will create keyframes for each of the sliced sprites. Once you added all of the animation frames, just hit the record button to exit record mode.
After the animation has been created, two things will be added to your Animations folder: animation and animator. Both of these give you different controls over your animation.
- Animation — Allows you to loop the animation and make some adjustments to the looping time.
- Animator — Controls when the animation will play according to different conditionals and parameter.
This is a basic animation since we need to it to continuously loop as the Game Object is created, but it still makes the Game Scene more dynamic.