To create a frame by frame sprite animation in Unity, follow these steps:
- Select your sprite sheet asset in the Project View.
- Unfold the sprite sheet to see the individual sprites (children objects of the sprite sheet asset).
- Select one of the sprites, and then drag and drop it into the scene's Hierarchy.
- You can rename the created game object.
- With the game object selected, go to Window |Animation.
- Click on the Create button in the Animation View to create a new Animation Clip.
- Adjust the Samples to the number of frames per second your animation was created with (12 in this example), as shown in the following screenshot:
- Make sure the record button is pressed. In the Project View, select all the frames (child sprites) in your sprite sheet asset and drag them into the Animation View.
- A frame by frame sprite animation will be created. Click on the Play button in the Animation View or run the game to see the effect.