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 materials on our game objects inside of Unity. OK. So we're stuck with this gray material, this default material. And what we want to do is go ahead and actually create some new materials. So let's go ahead and get started with this by actually selecting our meshes inside of our project folder. Because what I want to do is actually set up one material for each one of these instances. So if I create a material for this one, it's going to go ahead and duplicate that over to these others that are just duplicates of this one. OK. So let's get right into it. So let's go to our ceilings first. Let's just go right down the line. And I'm going to select ceiling one. OK. Now with ceiling one selected, you can see that you have your materials in your inspector. OK. Now the first thing that we need to determine is our shader type, what we're actually going to be using. So in this case, let's go ahead and hit this drop down box. And we see that we get a long list of different materials that we could use, or different shaders that we could use. So if you're looking for a surface that you want to use a normal map with, then you might want to use diffuse bump or bump diffuse here. OK. So this allows you to put on a main color or a diffuse color, OK, and then you have the option to put on a normal map. Now we have other options as well. We have a bumped specular. So if we go to this one, you'll see that we can put on that base color and allows us to actually adjust a specular color level, OK, giving us a shininess. So you can see on your preview that we have a little bit of a shininess on this object. Now this also supports normal maps as well. OK. We have decal which allows us to put on a base texture. So in this case we could do like a concrete wall. And then we could put on a decal, which is basically an image with an alpha channel on it. So I could put on a concrete wall, and then find the decal that is basically a concrete wall that's damaged. So I'm just putting up some damaged decals right on that concrete wall and making it really dynamic. Now I could keep moving on down. We have diffuse which is just going to be a color. We have diffuse detail to where we can actually add another texture onto this. We have parallax diffuse. So if we go to that, we have the ability to adjust the height map. So we have a base color, we have a normal map, and then we could adjust a height map on this. So then we have the option to actually adjust that height as needed. OK. Now a height map will work with a black and white image. OK. It works best with that. And then we can adjust the height from there. Let's keep moving on down here. We have parallax specular, which is the exact same thing as this parallax diffuse except it allows us to adjust that specular level, that shininess level. We have specular, which allows us to put on just a base color and then adjust the shininess there. We have vertex lit, which just allows us to put on just a regular texture. And then we have a shininess value. And then we have the specular color and this emissive color. And what this is going to do, is actually take the vertex colors that you have on your object and project those out. So let's go ahead and come on down and we have an effects to where we can add a flare. And this is for a particle texture. OK. Now the objects that we were going to be putting this on is not a particle. So we don't really need that. We have GUI to where we can actually add a texture shader. So if we're trying to make a heads up display or a GUI on our screen to show the score and our health, we can actually put a texture shader on those objects. Now we have our mobile section. And this is for mobile devices. And a lot of these are very similar to what we have in here, we just don't have as many options. Now we have nature to where we can actually create tree bark and things like that. We actually have a particle section for our materials. We have a reflective, to where it will actually reflect our geometry that is around it. We have render effects to where we can actually add a sky box texture to an object. Self-illumination is basically-- it's going to allow us to add a color or a diffuse map on it. We can add a normal map if we want, if we choose the right one. And then we can add a self-illumination map which will allow us to actually allow the material to look like it's actually illuminating light, like it's glowing or something like that. We have transparence to where we can actually create some fake ambient occlusion. And I'm actually going to use this later on whenever we get to some of those details. And then we have an unlit texture. OK. Basically no light is going to affect it. And then we have some legacy shaders that we can work with as well. So let's go back up to here and we're going to go to our bump diffuse. Because all I have is a base color and then I have a normal map. So I'm going to go to this base color and I'm going to hit select. Now this is going to bring up all of my textures that I have available in my project folders. So seeing how I've already imported all of my 2D textures, and if you haven't done so I would go ahead and do that now. There should be a textures 2D folder that you could just drag right into your project folder here. OK. So let's go back to our meshes and ceiling one. And we have our bump diffuse. OK. Let's scroll down so we can see our options again. And let's select our ceiling diffuse map, which is right here. And if we double click that, it's going to go ahead and apply that in there. And then we can go to our normal map section and hit select. And then we're going to choose our normal. OK. We'll double click on that. And whenever we put a normal in, it's going to say this texture is not marked as a normal map. So Unity Is going to go ahead and fix that for us. So we'll just go ahead and hit fix now. And now we no longer get that warning and this is going to work properly. OK. So let's go into our materials or inside of our level here and take a look. And we can actually see the objects that were with ceiling one have that diffuse color. And they also have that normal map on there as well. OK. So let's just keep going down the line here. So let's go to ceiling curved. And let's set up our material there. OK. So let's go ahead and go to that diffuse bump or bump diffuse. I keep reading that backwards there. And let's go ahead and click on our material. If you click on this, it's going to basically collapse that. If you click on it again, it will expand it. So if you can't find these options just click on this section right here. All right. So let's go to our texture. Use our ceiling and our normal map. And we use that one as well and it automatically applies this to our entire level. So you could see how very quick this can go. All right. Great. So now let's go ahead and select another object. So let's collapse our ceilings. Let's go to our doors. So I'm going to go to door frame here. And go to my material. And I'm going to go ahead and use that bump diffuse because I've created normal maps for all of these. So let's go to our doorway. Now I don't actually have a doorway material. But what I did is I combined it with another texture map. So here it is right here. We want to use texture map one. And then we'll go ahead and we'll go to our next normal map texture. And we'll scroll down to texture map one normal OK. Remember do that fix now. And that's been taken care of for us. OK. So now you can actually see this diffuse map right on our door frame here. So let's keep going down. Let's go to doorway. And let's do the same thing. Now I'm going to go ahead, and this is going to get repetitive. So what I'm going to do is go ahead and pause the video and if anything new comes up, I know that I'm just basically going to use the diffuse bumped shader. And then I'm just going to keep using the base color and then the normal map along with it. So you can go ahead and just go right down the list here in your project files and just apply every single material that's available there. So I'm going to go ahead and pause the video here and take care of that. OK. So I wanted to make just a couple of quick notes. I noticed that I hadn't actually named these exactly to the objects that we were going to be applying these textures. So I just I wanted to clear some things up just in case you had questions. So once you get down to the floors, you'll notice that floor two is this flat floor that we've been creating. And floor two, the texture map is named correctly, but this one doesn't actually have a normal map. I actually forgot this one. But that's OK. It's not a big issue. So just use floor two for that one. And then we also have four three which is basically just a modified version of floor two. So go ahead and use the floor two texture for it as well. Now when we get to the floor curved L and floor curved R, these are actually going to use that floor one, OK, with that red stripe on it. OK. So just use that one. And on that one, we also have a bumped diffuse OK. We have a normal map for it. So we're going to make sure that we use that one as well. OK. And remember that any time you apply a new normal map that hasn't been checked as a normal map, you need to go ahead and fix that. So always remember to check that fix now. So let's go ahead and do the same thing here with this one. So I'm going to choose that floor underscore one. And then we're going to go over to the next texture and choose that floor underscore one normal, or just floor underscore normal. OK. Now that's been applied. And what we can do is go ahead and finish this out. And let's go ahead and go down to our walls. Not going to go to the props just yet. We're going to bring those in our next lesson. Let's go ahead and take care of the walls, what we have on our screen right now. So we have, all right, we expanded the props there. Let's go to wall objects. There we go. And I have wall one. And I just wanted to make sure that we get this right. So I want to go to the bump diffuse. And let's scroll down to our texture one map. OK. Because this is the object that I mapped it to. And we're going to go to the texture diffuse, or I'm sorry, normal map. And let's go to our texture one underscore normal. And we've applied that. OK. Now let's go to wall two. And wall two is that flat wall. OK. So let's go ahead and use a bump diffuse. And we're actually going to use that texture number two. OK. It's just this piled concrete look here. So we've applied that one. And let's go to this next one. We're going to scroll all the way down to the bottom and do texture map underscore two. And remember to hit that fix now. OK. That's been applied. Go to wall three. And we're going to do the same thing. Wall three is going to use that texture map underscore two. Scroll down. And let's go ahead and close that one. And let's go to this next one, our normal. And apply that one. And then we'll finally do these last two. And these are exactly the same here. OK. Texture underscore two. And then our normal, which is going to be that texture underscore two normal. OK. And so our level's beginning to really come together here. So we've got our materials set up. And we're actually seeing what this is going to look like. So this is really exciting. OK. So there's our textures all applied here. And just want to take a look through my level. Make sure that I have all of my materials set up. I've got some initial lights going on. And if you want to at this point, you can actually go ahead and hit play. And just look at your level, what it's looking like right now. So this is looking pretty good. So you could also go ahead and do some initial tests. Make sure you test the walls. Make sure that you could actually collide those. And we don't have anything that we're missing. OK. So the next thing that we're going to do is we're going to go ahead and start adding in some detail into our level here. So we're going to start adding in some initial asset, some of those different props that we saw in our project folder. So we'll go ahead and do that in our next lesson.