Adding a single animation to a 2D Sprite in Unity is very easy.
In this quick guide I’ll show how I animate a powerup in my 2D Space Shooter game.
Start by adding the Animation window. You can do this by going to Window>Animation>Animation or by clicking on the 3 dots next to the lock icon>Add Tab>Animation
Next make sure your GameObject you want to animate is selected in the Hierarchy, in the Animation window it will now show a Create button, click that and it will pop up a window to save a new animation, name it and save it in an Animations folder in your Assets folder.
Once you save that anim file it will automatically add an Animator component to your GameObject and also create an Animation Controller as you can see in your Project tab.
Now find the folder that has your sprites for the animation in your Project tab, select them all by clicking on the first one and then holding shift and selecting the last one. Now drag them into the Animation window.
Now you can hit the play button and see how it looks when animated.
If the animation is too slow or fast you can change the Samples value and press enter for it to change.
By default, animations are set to loop. To change that setting you would click the animation/anim file in your Project tab and uncheck Loop Time but we want the powerup to be continuously animated so we will leave it checked.
If you were animating a prefab in the Hierarchy then make sure to apply Overrides so that all of the prefabs have the animation.
This is about as simple as animation gets, for multiple animations you will need to setup logic with use of the Animation Controller in an Animator window which you can open by double clicking on the Controller in you Animation component on your GameObject.