Hi ollyfour23
It’s very easy to animate sprites in Unity.
Step 1> Import your .png file (which contains multiple images in it) in the “Assets” folder.
Step 2> Just click on that image and look in the Inspector. In the ‘Texture Type’ drop-down menu, choose ‘Sprite (2D and UI)’. Next, in the ‘Sprite Mode’ drop-down menu, choose ‘Multiple’ (just because you have multiple images in a single png file). Hit ‘Apply’.
Step 3> Now click on ‘Sprite Editor’ button. A new window for Sprite Editor will open. Click on ‘Slice’ tab (top left corner). Keep ‘Type’ as ‘Automatic’, ‘Minimum Size’ to size of your individual images, Pivot as ‘Center’ and Method as ‘Delete Existing’.
Step 4> Click on ‘Slice’ button and hit Apply (present at the top bar of the window). Now close that window.
Step 5> Notice a small arrow appearing on your .png file in the “Assets” folder. Click the arrow. You’ll see that your image is expanded into a series of individual images. That’s good! Leave it like that.
Step 6> Now create an object, on which you want to see your animation. It can be a UI button or an Image, a simple plane or anything. Once you create an object, click on that object in the “Hierarchy”. Go to ‘Window’ tab (present in the menu bar). Select Animation. A new window will pop up.
Step 7> Click on ‘Create’ button. It will ask you to save your .anim file. Just give it a nice name and save it anywhere inside your ‘Assets’ folder. You will see a timeline in that window.
Step 8> It’s time to select all those individual images which you left expanded (hold Ctrl, or its equivalent on Mac). Once you have all your images selected, drag them to that timeline. Place them just right to the thin red (vertical) line.
Step 9> Change the speed of animation with the help of samples. Once you are satisfied, close the window. Your object will automatically attach an Animator Component to itself (don’t remove that). That’s it! 