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 do a final play test, and then we're going to build our game so that anyone can play our game. OK, so what I want to do is go ahead and just do an initial play test just to find out a couple of things that we might need to change before we actually build this game. So I want to check things like the fire, make sure that my health is going down properly. And I want to make sure that whenever it goes down to 0 that I will actually die and respawn. OK, there we go. And let's go ahead and check our animations on our doors. That's working properly. We can see a couple of seams that we have been our objects. We might want to go ahead and realign those. And if that's not working for you, we have a simple fix for that. So let's go ahead and keep moving down. We want to check walls and things like that, make sure that we have colliders on those. And you see here that I'm pressed up against this wall here. And you can see that I've got a little bit of clipping going through here. So I'll have to change that as well. And make sure that this fire's working, yup. And we want to check our objects, make sure that we have collisions on those. And it looks like these no longer have collisions, so we might want to go ahead and add those. And let's check to make sure everything else is working properly. OK, our door is opening here. And we actually have this set up to where we actually win the game. And if we hit New Game, it starts over. All right, so let's go ahead and let's stop this. And let's go ahead and take care of some of those issues that we have. So the first thing that we had was our camera. We had two problems that we can deal with in our camera. We had this background color showing that blue in our seams to where our objects were just a little bit away from one another. It was just barely a pixel wide, and they weren't exactly coming together. So what we can do is hide that by switching it to a dark grey color, or even black. Now, the next thing that we had was our clipping planes. And the reason that we were able to see through that wall was because our near-clipping plane wasn't quite small enough. So we need to take this down to like 0.1. OK, and let's go ahead and play test this just to see what that looks like. And everything was working great. And yeah, we can see that seam there, but it's not going to be really noticeable. We might have to go through and just push that up against there and take a look at all the rest of the seams to make sure that they're working properly. All right, so let's go ahead and hit Play on that. And let's go back. And now, let's go ahead and actually build this game. So what we need to do is actually go to File and Build Settings. Now, right now in my scenes to build, I actually have the two that I need to build. Let me go ahead and actually delete these out. So I'm just going to hit Delete on the keyboard on both of those. It's going to take them both out. And this is probably what you're going to see whenever you first build a scene. So we want to do add current to actually add this level. And then, we want to add our ending level. So to do that, we just go to our scenes folder that we have here and drag in our ending level. Now, once those scenes are in the build, and this is going to be every single level that's going to be in our game. So whenever we have those set up, we want to make sure that we're going to build to the right platform. So if you want to build to the web player, if that's something that you're looking for, go ahead and choose web player. In our case, we're going to do PC and Mac standalone. Now, once you've chosen your platform, you have a couple of options with those platforms. We have our target platform, which on the PC, we have Windows, and then we have Windows 64-bit. Now, we also have Mac as well. Now, in my case, I want to go ahead and use just the Windows. I don't want to use Windows 64-bit because not everyone actually has a 64-bit Windows version. Now, if we wanted to make this just a development build, we can go ahead and check that. But in my case, this is our final build, so I don't need that checked. Now, it's just as simple as hitting Build or Build and Run. So what I'm going to do is hit Build and Run. So it's going to go ahead and tell me, OK, what do you want to make this? Or what do you want to name it? So in our case, we're going to use this finalbuild.exe. We're going to hit Save on this. And in our case, I'm going to go ahead and overwrite that. And what you're going to get is this build player. And it's going to go ahead and compress everything and make everything nice, and neat, and bring it all together into our .exe file. And once this is finished, it's going to go ahead and bring up our Unity project configuration. So it's actually started our .exe. Now, what we might see if we built a splash screen is we would see it appear, just an image. And then, we actually have a couple of options that we can choose from. So our screen resolution, which is 1024 by 768, and if we want it to come up windowed, we could do that. And graphics quality, we could take this to anything that we want. Now, I'm going to go ahead and keep it as a good. and then my screen resolution as 1024 by 768 so you can actually see what's going on here. Now, I could go ahead and do the 1280 by 720, and that's probably what I'll go ahead and do seeing how our capture area is that. So let's go ahead and hit Play. And let me bring this up here to where we can actually see it. And our Unity project is now a .exe file. And now, we can give this to anyone and they can play this. So we can go through and just play around here. Looks like our level got pushed down just a little bit there. I can see the papers floating a little bit, not a big issue. And then, whenever we open this and we go to the door, it tells us that we win. Now, we can go ahead and hit New Game and start it all over again. Check any fire. If we're going to stand in the fire here, health goes all the way down to 0, and then we're restarting at our spawn point. All right, so this is the final lesson in our final build of our level. So I really hope that you've enjoyed really experiencing the Unity game engine, and hopefully I will see you next time.