Important Notice:

As of September 15, 2016, we no longer publish new courses on this website. We encourage you to use your Digital-Tutors credentials to sign in on Pluralsight where you'll find all new creative courses, skill tests and paths, 1:1 mentoring and more.
Assembling the level
See Details
Joshua Kinney


Joshua Kinney
In this tutorial, we're going to build our game world using our prefabs. All right. So in the last lesson, we had learned how to create prefabs from existing objects. And they could be meshes and things like that. And we can add in components and add that to our prefab. And now, what we want to do is we want to build our game environment. So I've gone ahead and I've created two of the prefabs in the last lesson. But I added one more in between lessons. And it's basically just a floor and a ceiling with three walls. OK? So from the last lesson, you should be able to know how to build something like that. Now if you don't want to necessarily build that, you can go to the prefabs folder and you'll find it in there. And it will be called mine shaft end. As you can see up here in your Inspector with it selected. All right. So now, let's go ahead and grab the straight section that we have in our section or in our scene here. And you can see that here in your hierarchy, just to make sure that you have the correct one selected. And we're going to hit Control D to duplicate that. And then I'm going to move it away from the other object. Now, your Move tool can be activated by hitting W on the keyboard, and that will be a shortcut. So now, what I want to do is I want to snap this to the existing environment that I already have. And I could do this by holding down V on the keyboard. And you'll notice that that snaps the gizmo to the closest vertex of my mouse here. And if I left click and hold on that square, that will allow me to move this object and snap it to the nearest vertex on another object. So we'll release that, and that has been snapped. All right. So I'm navigating around by holding down the right mouse button. And I'm using the W, A, S, and D keys to move. Now again, you can always use the Alt key and use your left, middle, and right mouse button to navigate as well. OK. So now that we have this, let's create one more straight section here. So I'm going to go ahead and hit Control and D to duplicate that. And I'm going to move this out away. Let's go ahead and hold V to snap those together. But what I want to do here is I want to create an intersection. I want to be able to go off in two different directions at this point. So right now, we don't have a prefab that we could use to create an intersection like that. But I want you to know that you can modify prefabs without worrying about tearing anything up. OK? So what I'm going to do is I'm going to select this wall here. And you'll notice that it is the only one selected because it's highlighting the box collider and the wire frame of that particular geometry. And you could see it selected here in your hierarchy as well. Now, I can delete this out. And whenever I do, it's going to bring up a dialog box about losing our prefab. And basically what this is going to do is it's going to break the link from our prefabs in our project folder. So I'm going to go ahead and continue. And you'll notice how that turns white, that text there. And that's letting us know that this object is no longer a prefab. And that's OK. I'm going to go ahead and delete this wall here as well. And now, we're ready to bring in another straight section across these sides here. So I can go ahead and make a duplication of this, so hit Control D. Let's move this over. And I'm going to go ahead and snap these together. So hold down V, and snap it right here. Now, the issue that we're having is there's a wall right there. And we can't have that. So let's go to our rotation tool. You can select here or hit E on the keyboard. And then, we're going to rotate this 90 degrees. So I'm going to hold down Control and then left click and drag along the y-axis of our rotation gizmo and rotate that 90 degrees. And you could see that reflected right here in your Inspector at negative 90. So now, you can see here that we could come around. And we have an intersection. And we can come right up in here. Now, the issue that we have here is we need to make sure that we're paying attention to the textures along our floor and our ceiling. Because you'll notice that they're not tiling any longer. So what we can do is we can select the individual objects for the floor and the ceiling of this particular prefab. But we could rotate those. Now, we can modify these and manipulate these without breaking our prefab. So I want you to realize that you can still modify that. So let's hold down Control. And then we'll rotate this 90 degrees here. And then we'll just drop that and leave it alone. And you could see that our textures are now matching up against. OK? All right. So we've created that. That's still a straight section. It's still part of our prefab. It's just been modified a little bit for our scene. And there's nothing wrong with that. That's perfectly OK. All right. So now, what we want to do is we want to create a copy of that or duplicate that. So I'm going to Control and D, grab my move tool. And let's move this out over here. And let's hold down V to get our vertex snapping. Let's select this corner. We'll left click and hold, and drag that to the object that we want to snap to. And there we go. So now, we've created an intersection. But now, you'll see that we have a missing wall. Now, we could put a wall here if we wanted to by just selecting an individual wall and adding that in place here. Or what we could do is add just a straight section and place it there as well. Now, what I want to do is I want to use that end. So I'm just going to select that mine shaft end. I'm going to hit Control and D to duplicate that. And let's move this over a little bit closer to where we want it to be. I need to go ahead and rotate it. Because you could see that the three walls are right here. So I'm going to hit E on the keyboard to go to my rotation tool. Let's hold down Control. And we'll rotate that 90 degrees. Then we'll hit W to go to our Move tool or just go to your Move tool up here. We're going to hold V to grab our vertex. And then we'll snap that into position. So there we go. Now, whenever we add objects like this and we start rotating, let's always check our textures to make sure that they are tiled right. And you could see that the floor and the ceiling need to be rotated. So we could always select those individually. Let's grab our rotation tool, and let's hit Control, so that way we can rotate, snap. And there we go. So now we have our texture. Everything is matching up as it should, and we're looking good. OK. So we can come and we could do a little bit of play testing here. And let's just hit play. And this is going to put us in position of our first person controller. And we've got a little bit of a maze going here. We can move around. All we have are walls at this point. We've got stone floors and ceilings. And you can see that we have our background in there. Now, we've talked about how to change the color of that background. And if we select our first person controller and we actually select the Camera that is attached to that, we could come in here to the background. And we could change that to something like black. And that makes it a little bit easier. Because as you could notice, we have some seams around these corners. Now, we can hide those with objects and things like that during the set dressing portion, but this always helps to change that background color to make it a little bit darker, especially if it's only going to be a level that is inside. You'll never go outside of it. OK? So you could see how that's changed there. Let's go ahead and hit Play to turn off that. And let's go ahead and finish assembling our level. Now at this point, you should have all of the knowledge that you need to assemble a level. And you can create a maze in any way that you would like. I'm going to go ahead and finish this out in between lessons. And you could do so as well using those prefabs that I've shown you, those tricks that you can use for making those prefabs. OK? And modifying those. So in our next lesson, what we're going to do is we're going to have our environment finished. And it's going to be a complete maze. And then what we're going to do is we're going to go ahead and start set dressing the level to make it a little more believable and a little more interesting. So I'll see then.
In this series of Unity tutorials we are going to learn about the core features in Unity.

We will start out by learning the Unity Interface where we'll talk about the different panels and tools available in the Unity editor. From there we'll learn how to properly export and import assets into Unity. With those assets imported, we'll discuss how to create prefabs that will help us speed up the construction process of our level.

Then we'll learn how to create and apply materials to our level prefabs. Then we'll take our textured prefabs and build a simple game environment. Once the base level has been built, we will talk about adding props and set dressing our level. From there we'll continue full speed by learning how to add lights, particles, and physics objects.

Once we're happy with our level, we'll jump into scripting in Unity. We'll learn how to create a random player spawn, a HUD, item pickups, and so much more. Finally, we'll end the course with how to publish our game to the platform of our choosing.

For an additional learning resource, download your free copy of our Key Game Development Terms Reference Guide and PDF so you can get comfortable with important game dev terminology.