To avoid having our in game sprites looking boring and static, Unity allows us to easily animate them.
We can do this through the Animation window —
With the GameObject we want to animate selected, we can create a new animation from the animation window. Find or create an appropriate location within your project’s file structure for the animation and give it a name.
This process will automatically place an Animator component on the selected GameObject and link it to your newly created animation file.
With all the links and components in place, we can hit ‘Record’ in the animation window and drag in the sprite files that make up our animation effect. The speed of the animation can be controlled by adjusting the ‘Samples’ field.
This is a very basic implementation of the Unity Animation system. There are many more features to it which I’m sure I’ll get to in a later article.