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 go ahead and start creating the base structure of our Unity game level. So here's where we left off in our last lesson. So if you want to start right up to this point, go ahead and load in the lesson scenes, lesson eight. Now, let's go ahead and bring in some of our prefabs. Now, what I did is I went ahead and created a couple of prefabs already, just to make this lesson go a little bit faster. If you want to learn more about creating the prefabs, go ahead and listen to the last lesson where we talked about that. So what I did was actually created a couple of prefabs, one for my curved hallways here. So basically I have my floor, my curved floor, and then I have a long curve wall and a short curve wall. And then I have the curved ceiling on this. So I went ahead and I prefabricated those. So if you want to figure out how that exactly is made, so let's go ahead and expand the hallway curved L. And you'll see that I've used wall curved short, wall curved long, and then ceiling curved. But then I also use the floor curved left, or floor curved L. And I did the exact same thing for a hallway curved R, so it's just the opposite. So let's go ahead and get into bringing in these objects and creating the base structure of our level. So the first one that I need is this hallway curved left. So I'm going to click and drag this into our scene. But as I do this, there's one important thing that I'm missing. I've created these prefabs, but I am missing something. If you'll remember whenever we first started, we needed to make sure that we had some components, some initial components, already applied to these objects. So you'll see here in your Inspector that I don't actually have a collider on this object. So I need to go ahead and just create that really quickly. So let's actually delete this out of our scene. So if it's selected, just hit "delete" on your keyboard. And what I'm going to do is actually go to my hallway curved L, and I'm going to expand that. And what I can actually do is go ahead and select that hallway curved L, go to Component, Physics and then Mesh Collider. Now you'll see that that Mesh Collider is applied to this object, and then we need to go down through the list. So if I go to wall curved short, you'll no longer see that Mesh Collider. So let's go ahead and apply that to this one. And we'll do this to wall curved short. I just need to make sure that these prefabs have some initial set up here. So let's go ahead and go to the long. We already have that component. I'm sorry, I didn't see that. And we have ceiling, so I'm not going to worry about that component with the ceiling. So now this prefab is completely set up with a collider. So whenever we start play testing this, I'm not going to fall through the level. So now let's drag this in. Let's go to our Rotate tool. And let's go ahead and hold down control and rotate this on our y-axis. And then what we're going to do now is go ahead and snap this guy right up to our floor here. So I'm going to use that vertex snapping. So if I hit W on my keyboard, that will take me to the Move tool, which is the only tool that will allow you to use vertex snapping. So that's really important. So let's hold down V on the keyboard and hover over the vertex we want to snap. Click and hold on that, and then move it to the vertex we want to snap to. Now, you'll see here that I brought in the wrong curve. You'll see that this is not matching up here. So I did that for a specific reason, so you would see that we really do need this hallway curved L and this hallway curved R. So let's go ahead and delete this, and let's bring in that hallway curved R. Now again, you'll see that that Mesh Collider is not there, so we need to go ahead and do the exact same thing for this one. So I'm going to go ahead and do that. So I just went ahead and I paused the video, and went ahead and applied that Mesh Collider to my hallway curved R, wall curved long, and wall curved short in this prefab here. So now, let's go ahead and drag this in, and then line this up here. So this is already rotated nice and neat for us, so let's just hold down V on the keyboard, grab that vertex that we want to snap, and then move it to the vertex we want to snap to. So as we snap these, it's always a good idea to get in there and just kind of see if this is actually snapped together properly. So in this case, it has, so we're ready to go ahead and move on. All right. So what I want to do now is go ahead and add a couple of straight segments in here for our hallway. So let's just bring those prefabs in. So we're going to use that rotation snapping, hold down control with our Rotate tool selected, and drag this along the y-axis. And then we're going to go to our Move tool. Hit W on the keyboard to do that. And we're going to use our vertex snapping. So hold down V, click and drag on that vertex, and then bring it to the vertex you want to step it to. So we're going to get plenty of practice at this vertex snapping, and you're going to be in pretty good shape with this. So you'll get the hang of using vertex snapping pretty quickly. So let's go ahead and make a duplication of this wall, because I want another one right beside it. So let's go ahead and hold down control and hit D on the keyboard, and that'll make a duplicate. And now I can go ahead and snap this one together. So let's hold down V, click and drag, and there we go. All right. So let's go ahead and create another curve here. So I'm just going to duplicate this one. Hold down control D, move this over, and then rotate it. So let's hold down control and rotate along that y-axis there. And let's go to our Move tool, and vertex snap. So we'll hold down V, and move that there. All right. So, now you're probably thinking, OK, we're doing the exact same thing over and over again. And what we're actually doing here is we're just creating the base structure of our level here. So we just want to get our floors and our walls in place, and then we'll start getting into actually creating some detail here. So let's go ahead, and I'm going to continue creating this here. Just a couple more times, so that way you can see the design that we're going for here. So let's go to our hallway straight. I'm going to drag this in. And the way I want this to work as I want the wall that's on this backside to actually be right here. So I'm going to rotate this around 180 degrees. So hold our control, and rotate this around. And let's go ahead and use our vertex snapping. So make sure you're on the Move tool. And we'll drag this down pretty close, and then we'll make sure that we actually get in there and look at that, making sure that that's snapped perfectly on there. So I'll hold down V just to make sure. All right, there we go. So now, let's go ahead and bring in our other curve, because I want this to actually curve off in the opposite direction. So let's grab our curved underscore-- let me make sure I have the right one. So I'm going to select my existing. And this one's curved R, so I want curved L. I need the opposite direction here, because I need to make sure that these ridges match up. So with that one in there, let's go hit V, select the vertex we want to snap to, and then snap it right to my floor. Again, zoom in and give it a closer inspection, make sure that it's nice and neat on there. So I'll try that one more time, and make sure that that is snapped to our floor. So now, let's go ahead and end this lesson. And what we're going to do in our next lesson is actually finish off this hallway that we're going to create. And then we'll get into actually adding a little bit of detail to our lesson here. So we'll see you in the next lesson.