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 to create a character controller so we can begin play testing our level and finding any issues that might be coming up in that level. So let's go ahead and bring in a character controller into our scene here. So what we're going to do is we're going to go to our standard assets. And we have character controllers, and we have a third person controller and a first person controller. So if you want a third person game, you can go ahead and create the third person controller. And if you want a first person controller, or a first person game, you would create this one. So in my case, I'm going to go ahead and just use the first person controller here. So I'm going to click and drag this into our scene. And it's going to give me a little capsule placeholder with a camera attached to it. Now, seeing how we're not actually creating a character, or we don't necessarily need a character, because we're not going to see it on our screen, we just have this capsule placeholder for this object. So what we're going to do now is go ahead and place this into our scene. So I'm going to put this in my room. And you can move this around. You can rotate it or scale it all you want. You could change its height if you need to. In your inspector, you can change its radius, and all of these different options that we have. Now, this first person controller has the scripts that are in here by default. So we want to go ahead and leave those the way they are for right now. So I'm going to go ahead and rotate this character around, just going to flip it around 90 degrees, just so it's actually facing my doorway whenever I start here. So what we need to do is make sure that we have this placed properly in our scene. So we can do this a couple of ways. We can actually switch over to our right view here, or our front view, whichever. And you'll see that our character's coming through that floor there. So let's actually switch over to wire frame. And I want to bring this character up above the floor. So that way, whenever we start play testing this, our character doesn't actually fall through. So let's go ahead and switch this back over to perspective. And we're going to switch this back over to that texture wired. And let's actually hit play and start play testing this. Now, you'll see that my character has fallen through our level, and theirs our level, and it's going bye-bye. So what we need to do is actually go ahead and try to figure out what is going on here. And this is the biggest part of play testing, finding issues and then trying to figure out an answer on how to fix them. So we know that our character is above this floor plane. So the only issue that it could be is that we don't actually have any colliders on our floor objects. So if we select this floor object, and we look over in our inspector, you'll see that we don't have any type of collider in this object. So what we need to do is go ahead and create one. Now, what I'm going to do is I'm going to create a very quick type of collider. So I have my floor II object. And I'm going to go into my floor objects folder. So in my meshes, I've got my floor objects folder. And let's select floor_II. And in here, if we scroll down in our inspector, we have our FBX Importer section. And we have a neat little check box that we have, and it's called Generate Colliders. And this is a really, really quick way to create colliders for our objects that are already in our scene. Now, to recap, we want to make sure that we have the object selected in our project folder, because if we make any changes to this object in the inspector, it's going to go ahead and carry over to any of the instances, or prefabs, that have been created in our scene, or in our hierarchy. So now let's go ahead and play test this. And we're still falling through there, so let's go ahead and check to see what's going on with this. So it's not actually working on our objects in our scene. So let's go back to that floor_II in our project folder. And let's check that Generate Colliders one more time. Now, you'll see that it's unchecked. And so this actually hasn't been applied. What we forgot to do was actually scroll down to the very bottom and hit Apply. So now, once we've done that, we are now saving any changes to our options. So now let's go ahead and play test this. And now we have our object colliding. Now everything looks really gray. And it actually looks like we can't see anything at all. And no matter where I move, nothing is happening. Now, our colliders are working properly. We haven't fallen through the level. Otherwise we would have seen that really bright blue sky box. Now, what is actually happening here is that our objects are not lit. They have no textures. So the great material is just blending into itself. We can't actually see that space. So what we're going to do now is we're going to go ahead and create some lights for our scene to light this up so we can actually see our level. So let's go ahead and do that in our next lesson.