[Unity2D] Importing your Sprite

Information
Step 1
In this lesson, we are going to learn how to import Sprite animations!
F27c9d6774e1a8eb5ee4e36e0e2db62c
Step 2
Open Up Unity, create a new project, Switch to 2D Mode, Create Project.
Temp1550186715
Information
Step 3
The 2D mode is a little different, we have a camera that only looks straight, and a flat 2D screen!
Step 4
Go on the internet and let's look for our sprites! Make sure it has Idle/Run, Slide, Jump, Attack, JumpAttack sprites.
Temp1550188440

For this lesson I will use the Ninja Girl Sprite

Here are some good sources for sprites.

Step 5
After downloading, look for where you downloaded the file. Usually it's in your downloads folder. Extract it.

It should be a .zip or a .rar file. If you need help extracting it, ask an instructor!

Step 6
Open up Unity again, and click and drag your Extracted Folder into your assets.
Temp1550259974

After importing, you should have your imported folder in your assets!

Check Your Work
Step 7
Open your imported folder (or files), and you should see them all individually.
Step 8
Lets try creating an animation! Let's select ALL of the same type of sprite. For now, let's try the Idle!
  1. Click the first one (Idle_000) (Then let go of click)
  2. HOLD down SHIFT
  3. Click the last one (Idle_009)

This will select all of them between the beginning and end.

Information
Step 9
This is called the Hierarchy, remember this when we "put something into the Hierarchy."
Temp1550261007
Step 10
Click and drag your selected idle sprites into the Hierarchy!
Step 11
Click on your Idle sprite object, then click on the Animation tab to open that up.
Temp1550261339

If you don't see an animation tab, then do this.

Step 12
Zoom into your sprite (If you want) and press the play button on the animation tab to see the idle animation!
Step 13
In the Animation tab, you'll see a "Samples" number, this is the Frame Rate. You can increase it for smoother animation.

I set mines to 30, you can set yours to any number between 12 and 90

Step 14
Rename your idle sprite object as "Player"
Step 15
Rename your idle Animation Controller as "PlayerController"
Step 16
Let's import another sprite! This time it'll be a different type of sprite, we'll use a Sprite Sheet instead.
Temp1550275405 Download Husky.png

For this course I'll use the Husky sprite sheet, you can download it here. Or look for our own Sprite sheet! (Make sure that it is transparent!! The background should look like a checkerboard)

Step 17
Click on your Husky spritesheet (or your own custom spritesheet), and Sprite Mode to Multiple, & Mesh Type to Full Rect.

Remember to click Apply after you finished.

Step 18
With your Spritesheet still selected, click on Sprite Editor.
Step 19
Let's enlarge the Sprite Editor window and make it bigger so that we easily see the sprites in detail.
Step 20
Now click on Slice and click slice again to divide all these sprites into individual objects

You should be able to finally select each sprite individually.

Step 21
Click on Apply in the Sprite Editor to save these changes.
Check Your Work
Step 22
Go back to Unity's project tab and this time you see an open arrow on the Husky sprite sheet, open it.
Step 23
Try to find which sprites are Idle, Running, Walking animations. And then click and drag that set to your Hierarchy.
Step 24
If your sprite is too small, change the sprite's scale to a bigger size. (All x,y,z values should be the same number)
Step 25
Adjust your sprite's frameRate (sample rate). If it's too slow, Increase frameRate. If it's too fast, Decrease frameRate
Step 26
Finally let's save your project! Click on File, Save Scene As, name this as Game.
Information
Step 27
That's it for this lesson! Click on Submit and go to the next lesson on doing player movements!
[Unity2D] Importing your Sprite Info

Account

MVCode Clubs

Created By

Nepgear tina (instructor)

Course:

2D Platformer Game

Access Level

premium

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach