What you will learn
In this Unity tutorial, we will learn how to effectively utilize the game engine. Over the tutorial, we will learn how to use the Unity editor interface as well as how to navigate in the scene view. From there, we will learn how to import assets and how to create prefabs. Then we will shape our level even more by adding character controllers, colliders, lights, materials and physics. We will then finish the tutorial by learning how to use scripting in order to make our level interactive.
In this lesson, we're going to learn how we can clean up our hierarchy by organizing it with game objects. OK, so we've been able to keep our project folder pretty nice, and neat, and organized. And you're probably wondering, why can't we do the same thing with our hierarchy? Well, there's not actually a folder base that we can use just like our project file. But what we can do is create what's called empty game objects and help us actually parent those objects together. And we could actually create little folders here. So let's go ahead and get into this. So what I'm going to do is I'm going to go to Game Object and Create Empty. Now, this first game object, I'm going to go ahead and select this and rename it. I'm going to call this floors. So with that, I'm going to go ahead and select all of my floor objects. It won't select this one here. Let's try this one more time. Hold down Shift, select all of these, and drag these right onto that floors. Let's create another empty game object. And let's call this one hallways, or hallway_objects. Now, let's find that game object there. There we go. And let's select this section of them. And let's drag that right onto hallway_objects, and we'll go to this one, put it on hallway_objects. And let's go ahead and create props section here. And I'm just trying to take a look at my hierarchy and see how this is all put together. And let's go ahead and do that. Let's go ahead and do props here. So New Game Object, Create Empty, rename this. Call it props. And let's go ahead and select cryopod open to close. There's crate piles. And let's go to crate pile here. So let's drag this down to our props, keep going. There we go. Now, I want to go ahead and keep going with this. So let's go to our pipes. We've got tons of paper. And let's drag all of these to that props pre-fab there, or parenting hierarchy. Let's go and take care of the walls here. Let's go to Game Object, Create Empty, and rename this. And we'll call this walls. Now, what we're doing is, this is a work-around to organizing your hierarchy. And I really recommend doing this because this can get very, very tedious in a very long list. So instead of searching through all of these, if we create empty game objects and give them a name, and then parent everything to that empty game object, what we've done is we've essentially organized our hierarchy. Here's our rubble large that I've created. And I'm going to put that in my props folder there. Now, if you're wondering what that rubble large is, it's actually this object here. And this is in the props folder. And I just brought this to block this doorway. So if you were wondering about that, you can go ahead and do so. All right, so let's go ahead. And we have this. And it's actually showing our props folder open. So it looks like now what we need to worry about is our lights. So let's create another empty game object. And let's rename this and call it lights. Let's select all of our point lights, put those in there, just drag and drop right on lights. There we go. So let's go ahead and do-- let's see, there's barrel pile. Let's put those in our props folder. There we go. Let's create a particles game object. Call this particles. And let's go ahead and grab our fire and put those in that particles. And we have doorways. So let's create a game object called doorways. There we go. Drag that right on top of there. And then finally, let's go ahead and do ceilings. We might do one more for those capsules. We'll put that as collisions. And ceilings, select all of those. Drag those right on top of ceilings. And then, one more game object. Create an empty one, and we'll rename this colliders. So we'll call these capsules here because we use these on the cryo tanks. And there we go. So now, we've successfully used empty game objects to basically create a folder system in our hierarchy. Now, we don't actually have folders. But we just created these empty games objects to act as folders. So this is a way to keep your hierarchy nice and clean. And you can search through this and keep it organized. The best thing that you want to be able to do is organize it enough to where you can pass this off to somebody else, and they know exactly where to find something. So that's how we can clean up our game level. And we are actually finished with creating the game level itself. The final thing that I want to do is actually create some doors inside of our doorways so that way, Chris can come in our next lesson and talk to you about scripting and actually creating a script to open up a door using an animation. So let's go ahead and bring those doors in and get that ready for him. So we're going to go to our Meshes. We're going to go to Doors, and I have sliding door left, and I have sliding door right. So I'm going to bring both of these objects in. And let's bring in sliding door left. Here we go. And what I'm going to do at this point is go ahead and snap this one. So I'm going to hold down V, snap them together, and then select both of them and line them up inside of our doorways. Now, like I said, with these, you don't have to be exact. You've just got to get them in there to where they're fitting nice and neat. They're not penetrating through the walls or anything like that. So that's good enough for that one. Let's hit Control D to duplicate. And let's move this one straight back to this doorway here. There we go. And Control D one more time, and I'm going to hold down the rotate tool, and hold down Control to snap that because I want to bring this right over here. There we go. Now, one final thing that I want to do before we end is actually replace this wall right here because we're actually going to make this the exit to exit this game. So that way, we can give you a win state whenever we're finished with this level. So what we need to do is we need to select just this one wall. So you'll notice that whenever we try to select it, it selects that entire pre-fab. So just click on that wall one more time and that will select just that one. Now, by deleting it, you're going to lose that pre-fab. And that's OK. So let's go ahead and create a copy of this set of doors right here. So I'm going to duplicate this, Control D. And let's go ahead and move this into position. So I'm going to rotate it, hold our Control to snap this 90 degrees. And let's go ahead and move this into place. So hold down V. Here we go. Make sure this is lined up nice and proper. Let's pull this back here. Here we go. So now, we've got our doorway set up. And now, what's going to happen is Chris is actually going to come in and he's going to teach you how to actually script on these doors to actually create some triggers that's going to open doors. And then, he's going to show you how to create a script for your health, and then show you how to do a script for getting the door open so you can actually win this level. So you'll do that in the next lesson.