Sprite Sheet to Unity 6 Animation, Start to Finish
Turn one sprite sheet into a character you can control in Unity 6, start to finish. Check the frame size in SpritePilot, set the import settings that keep pixel art crisp, slice the sheet on a grid, make the clips, set their speed, wire up the Animator and add a short C# script so the slime idles, hops, turns and attacks.
Chapters
Transcript
0:04 In this video we take a sprite sheet and turn it into a character you can control in Unity 6. By the end, this slime idles when it stands still, hops when it moves, turns to face where it's going, and attacks when you press a key. We'll go start to finish: checking the sheet, the import settings, slicing, the animation clips, the Animator, and a short script. Everything here is free, including the slime.
0:35 Here's our sheet. The top row is idle, four frames. The middle row is a hop, six frames. The bottom row is an attack, five frames. Unity's slicer needs one number from us: the size of a frame. Open the Sprite Player in SpritePilot and drop the sheet in. Set Columns to six and Rows to three, and it tells you: eighteen cells, each thirty two by thirty two pixels. It plays straight away, so you can check the frames run in the right order. If your sheet isn't a neat grid, cut it in Sprite Detection first and export it as a grid sheet.
1:18 In Unity Hub, create a new project from the Universal 2D template. Drag the sheet into the Assets folder and select it. Unity 6 already made it a sprite with many frames, so three settings are left. Pixels Per Unit: thirty two, so one frame is one unit in the world. Filter Mode: Point, no filter, so the pixels stay sharp. And Compression: None, because compression smears small pixel art. Press Apply.
1:55 Unity has already cut the sheet, but tightly around each drawing, so every frame is a different size and the slime would jump as it animates. So click Open Sprite Editor, then Slice. Choose Grid By Cell Size and enter thirty two by thirty two, the number from SpritePilot. Set the Pivot to Bottom, so the slime stands on its position and every pose lines up. Leave Keep Empty Rects off, so the three empty cells don't become sprites. Press Slice, then Apply. Every frame is now its own sprite.
2:37 Unity has a shortcut for the first clip. Select the four idle sprites and drag them into the Scene. Unity asks where to save the clip, then makes a GameObject that already plays it, with an Animator ready to go. Rename it Slime. For the other two, open the Animation window, choose Create New Clip, call it run, and drag in the six hop sprites. Do the same for attack, with the last five.
3:11 Now the speed. In Unity, a clip's sample rate is its frame rate. Turn on Show Sample Rate in the menu at the right end of the timeline. Set idle to six frames a second, run to ten, and attack to twelve. New clips start at sixty, which plays the whole hop in a tenth of a second. Then select the attack clip and untick Loop Time. An attack should play once.
3:50 Open the Animator controller. Add two parameters: Speed, a float, and Attack, a trigger. Make a transition from Idle to Run when Speed is greater than point one, and back when it's less. Make transitions from Idle and from Run to Attack, on the Attack trigger. And one from Attack back to Idle. On every transition except that last one, untick Has Exit Time and set the duration to zero. Otherwise Unity finishes the clip before it switches, and the slime keeps hopping after you let go. The last one keeps its exit time, so the whole attack plays before it goes back to idle.
4:52 The slime needs a body to move: add a Rigidbody2D and set its gravity to zero, since it only moves left and right. Then add this script. Each frame, it reads the Move action, moves the body, and tells the Animator how fast it's going. If it's moving, it flips the drawing to face that way. And when the Attack action is pressed, it fires the trigger. The Animator does the rest. The two hitbox lines at the bottom are for a hit box during the attack; the written guide shows how to use them.
5:30 Press Play. It idles. Hold left or right and it hops, turning to face the way it moves. Click, or press Enter, and it lunges, then goes straight back to what it was doing. That's a working animated character, from a single sprite sheet.
5:52 Five things go wrong most often. If the sprite is blurry, set Filter Mode to Point and Compression to None. If it animates far too fast, the clip is still at sixty samples. If it keeps hopping after you let go, a transition still has Has Exit Time on. If it gets stuck in the attack, the transition back to idle has lost its exit time. And if the script errors on Input dot GetAxis, it's an old script: Unity 6 uses the Input System, like the one here.
6:30 That's the whole path: check the sheet, import, slice, clips, Animator, script. The slime sheet is free to use in your own games, and SpritePilot is free in your browser, with nothing to install.
More video tutorials
Sprite sheet toolsHow to Cut a Sprite Sheet Into Separate Sprites
Sprite sheet toolsGIF or Video to Sprite Sheet in Under a Minute
Sprite sheet toolsRemove a Sprite Sheet Background, Then Trim and Pad It
Free assetsFree Game Assets: Sound Effects, Pixel Font and Parallax Backgrounds
Sprite sheet toolsMake a Sprite Sheet From Separate Images
Game artDraw and Animate Pixel Art in Your Browser
Sprite sheet toolsPreview a Sprite Sheet Animation and Turn It Into a GIF
Game artBuild a Tile Map in Your Browser
Sprite sheet toolsSprite Sheet to Godot 4 Animation, Start to Finish