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 colliders is for our assets in our scene. So here we've got our level. We've got plenty of materials on it. We've started adding some detail. And maybe you've taken some time between these lessons and really just gone through and created some really neat take detail by adding more paper and more crates and things like that. At this point you've got enough knowledge to go ahead and do that. You know how to move objects around and get them into position. And even able to apply some materials to them. So what we're going to do at this point is we're going to start making some of our assets a little more interactive. As of right now these assets are just sitting there. And we're not able to actually collide with them. We're going to be able to walk right through them. So let's go ahead and hit play. And let's just move around here, and you can see that we could walk right through this asset. And I know that we've been using that mesh collide, just doing that very, very quickly. And we've been using the generate colliders. But whenever we have an object like this that's a little more advanced, and we don't really need an advanced type of collision, we may want to go ahead and just use a very basic type of collision. And let me show you what I mean by that. So let's go ahead and hit play. And what I'm going to do is go ahead and grab a game object. Create other. And I'm going to create a capsule. Because I'm going to use the collision object that's on a capsule and engulf the cryopod around-- or I'm sorry engulf the capsule object collider around my cryopod. So that way I have some interactivity and some collisions to work with. So we'll do capsule. And you'll notice that our capsule is pretty far off here. So what I'm going to do is go to Game Object and Align to View. Yeah, let's go ahead and do Align to View. And here we've got our capsule that has been brought a little bit closer to us. And I'm going to actually move this toward my capsule here, or my cryopod. And I'm going to switch this from global to local. I'm just going to move this little bit closer. If it's slanted like this and kind of off, it's not a big deal. Because we can always rotate this capsule as we need to. So let's go ahead and line this up to our object here. And if I wanted to, I could actually go ahead and line up my view to my cryopod a little bit better. Just kind of like if I'm looking right at it, and do Game Object Align to View. And that's one way of doing it as well. So it's all about finding ways to manipulate these assets. So let's go ahead and rotate this guy to where it matches up to our cryopod a little bit better. OK, so let's grab our Move tool. Pull it out just a little bit. And with this capsule selected, what I'm going to do is actually get rid of this capsule mesh filter. So let's go ahead and select it. And we're going to right click on it and Remove Component. And I'm going to also turn off this mesh renderer. Now I could actually go ahead and remove this component as well. And all I'm left with is the capsule collider. Now with this, let's go ahead and adjust our height on this. So let's go ahead and take our height up, just elongate this. And it can go through the floor, that's OK. And let's line this up to our pod just a little bit better. And we're just checking all sides to make sure that this is lined up nice and neat. And then I'm going to take my radius up just to make sure that whenever my player runs into this it's going to stop them. They're not going to be able to get inside that capsule at all. All right, so there we have that capsule collider. And now I'm ready to go ahead and play test this. And see how this is going to work. So let's go ahead and play test this. And we use it on this one. And now you can see there we're no longer able to bump into or run into the actual cryopod here. We're not able to run through it. So we have that collider working. And now we can go ahead and actually duplicate that into the rest of these if we wanted to. Now if you want to size this up just a little bit better you can do so. I noticed that it was kind of stopping me a little bit before the cryopod. So I'm just going to rotate it just a little bit. And then push it back into it just a little bit more. There we go. I think I'm pretty happy that, with the way this is turning out right here. So now I'm going to go ahead hit Control D. And duplicate this one. Let me try it one more time there, there we go. We've got several of these capsules here. This here. Here we go. Capsules were just disappearing whenever we deselect them. So let's select all three of those. And I'm going to go ahead and rotate those. Duplicate those, so Control D. And then rotate-snap those holding down Control. And that didn't really help, did it? Let's go ahead and rotate them in the x direction. And now let's go ahead and switch this from local to global. So that way we can just move these straight back. There we go. Now I noticed my rotation is off just a little bit. So let's go back to that rotation-snap and then rotate this here. There we go. Now that's lining up a lot better there. So now if we play this we could run into any one of these cryopods and we're not able to actually move through it any longer. So that is one way of creating colliders there. Now looks like I'm missing a Collider there. Let's see what's going on with this. Let's pause this really quickly. And it looks like these three just aren't working out all that well. So let's see what's going on here. Let's go ahead and select one. Let's go to our capsule. It looks like I've only got three here. And you know what? I only have three. I didn't copy those properly, or duplicate those properly. So let's let those three again. Control D. There we go. Now let's go ahead and move this over to the other side. And then let's rotate this back. Here we go. Now I should be able to play this with no problems. Collision there, let's check this one here. And we have collisions there. So the main reason that we have this lesson is to show you that we can actually create colliders that are very, very basic. And they're made from primitive objects. And sometimes we don't necessarily need a collider that is conformed exactly to the object itself. So it wouldn't make a whole lot of sense to actually create a collider that would fit exactly to this geometry. A capsule collider is going to work just as well. So with that, we're going to go ahead and we're going to move on. And we're going to get into creating some particles for our geometry. Or for our level here. We're going to create some fire and really set off this level here.