Important Notice:

The Digital-Tutors site will soon be retired and your access will be turned off - but don’t worry, you can still enjoy all your favorite Digital-Tutors content on Pluralsight (plus thousands of additional courses, skill assessments, paths and more). You can log in to Pluralsight with your Digital-Tutors credentials, as well as update your password at any time on Pluralsight. Please contact us with questions or concerns: support@pluralsight.com.
Slicing the character
See Details
Joshua Kinney

Pluralsight

Joshua Kinney
In this lesson, we're going to split apart our character. All right. So we're going to bring in a character, and I'm going to show you how to do a multiple split for a character. That's the same process that we use for the foreground. But there are a couple of things that I want to go into with this. First off, let's go ahead and select our character. And we're going to switch our Sprite mode from single to multiple. And we're going to click on our Sprite editor. And we're going to bring this up. Here you can see that it's gone ahead and its sliced all of this together. You may not get it perfect like this. You may have something like the eyebrows are single pieces or something like that. Not a big issue, because what we can do is we can actually get rid of one of those just by selecting it and hitting Delete on the keyboard. And then what you can do is, you could just take the box and surround a single box around the eyebrows, and then hit Trim. And that will put that down just like so. So as you can see here, our character is split up into several different pieces. We've got eyebrows. We've got the eye, the head. Everything is just split apart this way. We've only got one leg. And the reason is is because we can duplicate one of the legs and put it on the other side. And we'll talk about ordering it here in just a moment. But as you can see, everything is split apart just like so. Everything is set up. It's going to be the same process that we had before. Now there are going to be a couple of things that are going to be a little different about a character like this. The first thing that we need to pay attention to is the naming of all of the different sprites. So you'll want to go in and you'll want to rename those-- so eyebrows, eye, leg, lower leg, foot. Actually let's go ahead and call this leg upper. And we'll leave that one there lower leg. This one is going to be foot. OK. Yeah. This should be fine. And we have the upper arm, left and right. Same thing for the lower, and the hand. Then we have the head, obviously. So all of these parts are named. Once we have finished all of that, we're going to hit Apply. And then we can close down our Sprite editor. Now before we close the Sprite editor, there's one more important piece that you want to pay attention to. And that's going to be the pivot point of these sprites. Now, the pivot point is going to be important, because that is where it's going to rotate around. So we're going to be animating this character. And the reason that I wanted to animate a character like this is so that way we can see exactly how to use the Sprite editor and how to use the animation tools for the 2D features in Unity. So to adjust a pivot point on a sprite, you simply select the pivot point by left clicking on it. And you can drag that and move it wherever you need. So I'm going to put it right here on the ear, because that's where the neck is going to go into. And then, we're going to take the body. We'll leave that at the center, just like so. Or if you want, you could put it like right here around the hip. And that's going to be like a major rotation point for the body. I would go ahead and suggest doing that. And then we have the undies here. We could put those here at the top. And it's going to be kind of along the same lines as this point here. We have the leg. We're going to rotate around the top here. And then we have the lower leg. We're going to put that right on the knee. And you can see that it's trying to snap. You may have to zoom in just a little bit more, and that will keep it from snapping like that. The foot is going to pivot right around this point here. You could do the ankle if you wanted to, but I think it's going to be better to put it right here. The hand is going to go right on the wrist. And then, the lower leg right here-- or the elbow, excuse me-- the lower the arm, and then the upper arm, right around in here. And we'll do the same thing for this one. Just get them fairly close. That's good. So we've got the head. The eyebrows, I'm not too worried about those. They could be right on the middle there. The eye, probably the same thing-- leave it right on the center. But that should be good. So everything is now set. All the pivots are set. All we have to do is hit Apply. So now whenever we bring those in, those will pivot around those areas. Now if you've already sliced everything and you've got it set up just like this, no worries. All you have to do is just go to your Sprite editor. And then select it, and then adjust the pivot, and then hit Apply. So it doesn't matter if you do it before or after. Even if you bring in one of the elements-- so if we start bringing in the pieces for the character-- so if I start out with like the eyebrows here, I'm going to bring this down below the ground so I can see all of this. If you start bringing in these pieces like so, you can see that the pivot point is right here. If I wanted to, I could just go into my Sprite editor by selecting the character. Go to Sprite editor, select the eyebrows, and adjust that pivot point to be right here, and then hit Apply. If I close that and I select this again, you'll notice the pivot point has changed. So it doesn't matter if you do that before or after. I prefer to do it before, just because. Now if you want to reset that pivot point to center, select it, go to your pivot point here, and then you can adjust any of these presets. So I'm going to put that to center, and then we will Apply, and close. Now you can see that that is now centered up again. All right. So let's go ahead and bring in the rest of these pieces. I'm going to bring in the body. Notice the pivot point there. Let's bring in the eye and the head. I'm just going to drag these in for right now. And I'm going to try to keep them fairly close together as far as their groups go. But I'm going to bring them in in order, so that way, I don't forget anything. Arm lower right, arm lower left-- that's the one with the bone. And then foot. And then finally, the hand. So all of those pieces have now been brought in. Now all of these pieces here, they need to go on their own sorting layer. Right now they're on the default sorting layer. So we should have 13 objects. Let's go ahead and set this to the sorting layer for Character. And I've already set that up. And I've already ordered everything as far as the sorting layers go. Now ordering them in the layer is going to be a little trickier. So starting out with individual groups is going to be the easiest thing to do. So selecting the head, this is going to be on Layer 0. Actually, let's start with the body. This is going to be on Layer 0. We're going to put to the head on Layer 1, because it's going to overlap the body, just like so. So I'm going to position this right about here. And then, we're going to select the eyebrows. And we're going to put that on Layer 2, because that's going to be over the head, which is on Layer 1. And we'll position those eyebrows about where they should go. Select the eye. We're going to put that on Layer 2. And we'll put this into position here. And let me select the eyebrows again. Let me pull those up just a little bit more. There we go. There's all of that. If you want to reposition some of these, you're more than welcome to. Zombies aren't exactly supposed to be pretty. All right. So now we have on the undies. We're going to put that on Layer 1. That's going to go over the body, just like so. And then we have this leg. This is going to go over the undies, so we're going to put that on Layer 2. And we'll put that right here. And then the lower leg, put that right in here. And that can go underneath that. so it's going to be on Layer 0. And then we have the foot, which I'm going to put on Layer 1, so I want it to be drawn on top. And there we go. Now you can also take the leg here. Let's go ahead and select both parts of the leg and the foot. Let's hit Control and D to duplicate that. And we're going to bring that to the other side. Now we have a little bit of an issue here, because now the leg is supposed to be underneath the undies here. So let's go ahead and set that to Layer 0 there. So now that's going to be underneath there. But now we have a little bit of an issue with a possibility of Z fighting here. Now we could go ahead and reset all the layers like we had before. And instead of the body being on Layer 0, we could put the body on Layer 1, and then adjust everything that way. Instead of doing that, what I could do as well is I can turn off this 2D view. And I could take the leg pieces and I can actually just move those out in the Z to put those behind. Nothing wrong with that. That gets rid of our Z fighting issue, and it also separates some things. Now we will have some Z fighting issues between the objects in their order here. So let me go ahead and just take this leg here. I'm going to put that behind a little bit. And we could set up that way. Now if you're more comfortable with doing in that way, nothing wrong with that whatsoever. Either way is fine. Now I know that these are ordered properly, so we're not going to have any Z fighting issues. So those can stay right on top of one another like that. Now the arms, let me go back to my 2D view. We can go ahead and set these up. So we'll do upper and lower arm and the hand. Here we go. So the lower arm, we're going to set that-- or excuse me, the upper arm, we're going to set that to Layer 1. This is going to be on Layer 2. This one will be on Layer 1. And then just to kind of reduce any problems with Z fighting, the possibility of that, I'm going to go to the 3D view. And I want to pull that front arm out, like so. And that way, it's not conflicting with a leg or anything like that. So it looks a little funny, but we're in the 2D view. We're not going to be seeing any of those issues. Now let's take this one, let's put that in. And now that that is in position, we're going to take this guy here. We're going to leave it on Layer 0. We'll put this one Layer 1 because they are touching one another. And then, I'm going to take this, and I'm going to put it behind. But you can see that it's overlapping the body. Let's go to the 2D view-- or 3D view, excuse me. And let's pull that back behind. So now we won't have any of those issues. And we can go to 2D, and you can see how that is now set. Perfect. So now we have our character set up. All of the pivot points are set. We have our layers ordered properly. If you like, you can go ahead and you could select all of the different pieces here. Like let's select the eye first, the eyebrows, and then the head. And then in our 3D view, let's pull that out, away from the neck like so, just to kind of help out with selection and making sure that we don't have any issues like that. Now I do see a little bit of an issue. If we come around to this side, we do get a little bit of Z fighting there. But that shouldn't be a big issue. Let's go to 2D. And there we go. So now everything is set up. And now, we're ready to start rigging the character. So the way that we're going to do this character for this particular project is we have all of these different pieces. We've got their pivot points set up. And now, we're going to start parenting the different individual pieces of the character. And we're going to use our animation tools right here inside of Unity to animate this character. And we're going to go ahead and get started with rigging next.
In this series of training we will discuss the major components of working with the 2D features in Unity. We'll start off by learning how to set up a 2D Unity project. Then we'll learn how to properly import and slice our sprites. After that we'll learn how to manipulate sprites by blocking in a simple platform level and also learn the importance of Sorting Layers.

Then we'll jump into the real fun by assembling, parenting and animating a character. By the end of this tutorial, you will have a better understanding of working with Unity's 2D features.
Introduction and project overview
1

Introduction and project overview

 
00:45
Setting up a 2D Unity project
2

Setting up a 2D Unity project

 
13:05
Manipulating sprites
3

Manipulating sprites

 
14:03
Setting up props
4

Setting up props

 
13:35
Slicing the character
5

Slicing the character

 
13:57
Parenting the character
6

Parenting the character

 
09:25
Creating the colliders
7

Creating the colliders

 
11:10
Creating the idle animation
8

Creating the idle animation

 
17:31
Blocking in the walk cycle
9

Blocking in the walk cycle

 
11:50
Finishing the walk cycle
10

Finishing the walk cycle

 
08:06
Setting up the animations
11

Setting up the animations

 
04:49
Scripting the movement
12

Scripting the movement

 
12:55
Using sprite sheets for animation
13

Using sprite sheets for animation

 
07:48