Animating in Unity
This short course will teach you the basics of creating an animated sprite that you can use in a Unity 2D video game.
Start a new project in Unity. Make sure that you've selected the 2D Format.
Next, import your spritesheet. It's important that you use a spritesheet with a transparent background to save you time in a moment. I've included a sample spritesheet that you can use for this tutorial.
Select the spritesheet from the Assets folder in the Project panel, then go to the inspector. Change the Sprite Mode to "Multiple," then enter the "Sprite Editor."
We're going to use the "Slice" function in the Sprite Editor to cut out each frame of our animation and turn it into its own image. To do this, simply click on "Slice" in the upper lefthand corner of the editor. Make sure your settings are the same as those shown in the second image, and then click "Slice" in the popup window.
Now each frame of the animation is highlighted in its own box. If you click on each box, you can adjust it to better fit each image. Once you're satisfied, click "Apply" to save your images, then exit the editor
Select the first frame of your animation and drag it out into your scene.
With your new object selected, click "Add Component," select "Miscellaneous," and select "Animator."
Next, create a new animation by selecting "Assets," then "Create," then "Animation."
Open the Animator panel, and drag your newly-created animation from the project panel to the Animator panel.
Now select the Animation panel. Select all of the frames of your animation, and drag them onto the first line of the Animation panel. Now if you click the Play button at the top of the screen, your character will walk for one cycle!
If you select your new animation from the Project panel, then go to the Inspector panel, you can check the box for "Loop Time," which will make your character walk in a constant loop whenever you press "Play."