Important Notice:

On July 31st, 2017 the Digital-Tutors library will be retired along with Digital-Tutors concurrent licensing. Effective August 1, 2017 any active group plans will be redirected to www.pluralsight.com. Each group plan will receive one individual user license on Pluralsight for each active Digital-Tutors license. Please contact your account representative for any additional questions.
Creating materials
See Details
Joshua Kinney

Pluralsight

Joshua Kinney
In this tutorial, we're going to discuss how to create materials inside of Unity. So whenever we bring in our objects, it's always a good idea to go ahead and have materials set up for them. So to get started with this, we can create materials right here inside of Unity. So to do this, I'm going to go to the materials. Folder that was created whenever we brought in our meshes. Now, you'll notice that in this Materials folder, there is a default material that has been brought in. And this was brought in right from 3ds Max. Now normally, I like to get rid of this default material. You could go ahead and keep it and rename it if you like. But normally, I just get rid of it and start a brand new. So if I want to create a new material, I'm going to right click in here, and I'm going to say create material. Here, we can give it a name. And I'm going to go ahead and call this Stone Floor. And whenever you create a material, the next thing that we want to do is choose the Shader that you want to use. So the Shader is going to give you different capabilities for your material. So for example, if you were wanting something with a Bump map feature so you can apply a normal map or if you wanted something that has alpha capabilities, you want to make sure that you choose a different Shader as well. So let's go ahead and click on this list, and you'll see that you get several different types of shaders that you can use. Now, we're not going to be going over all of them, but we'll take a look at a couple of different ones that are really important and used quite a bit. So the first one is Bump Diffuse. If we select that, you'll notice here that we have a base, which is going to be our diffuse map, and then we have our normal map slot. And this is going to allow you to use those two textures. Now, if I go ahead and go to Bump Specular, you'll notice that it gives me a specular color information. If you have a material with a specular channel applied to it, you will have to use this. And it will update this appropriately. And you also have shining as to where you can adjust that glossiness of that object. So now we can go into a couple of different ones. One that is used quite a bit is this Transparent. And then here, you can see we have Bumped Diffuse as well. But notice that this allows you to have an alpha channel applied to your diffuse. And so if you have that, you want to make sure that you're using this Shader. I'm going to go ahead and go back to the Bumped Specular. And in here, we're going to input a texture. Now, we haven't actually imported any texture. So let's show you how to do that. So I'm going to come into my Imported Assets. I'm going to right click and Create a New Folder. And let's name this Textures. Inside of my Textures folder, I'm going to right click and Import a New Asset. And we're going to go to our Unity folder, Referenced Files, Textures. I'm going to go ahead and go to the floor. And you'll see that I have a Diffuse, a Normal, and a Specular. So on my Diffuse map, I'm going to go ahead and import that in. And you'll see that when it imports, it brings up our Import Settings. The one thing we need to pay attention to is going to be your texture type. So what is it going to be used for? In this case, it's just going to be used as a texture. But you could bring in textures that are going to be used for things like the GUI. So if you're creating a HUD, you want to make sure that you change the type to GUI. Now, we have several different other types that we can use. The familiar one that you're going to see is Normal Map. And this is going to be really important whenever you import Normal Maps. So with that said, let's go ahead and import our Normal Maps. So I'm going to right click Import New Asset, and then our normal. So I import that in. And you'll see that comes in as a texture. We could go ahead and switch it over to Normal Map, but I want to show you something really quickly. We don't necessarily have to switch that over to a Normal Map, because Unity does a great job of checking and realizing what kind of object this is based on where you place it. So get started here. Let's go ahead and go to our Materials and select that stone floor material. And let's apply those textures. This could be done in one of two ways. We can go to the Textures folder and click and drag the texture we went into the slot. Or we can simply hit Select and choose it from this list here. And it looks for whatever is in your project. So if I double click on that, that's going to be imported in. And there are our normals. Now, you'll notice that it doesn't appear appropriately in our Previewer. And that's because it doesn't recognize this as a Normal Map. However, it does say here that the texture is not marked as a Normal Map. So we can go ahead and just hit Fix Now. And it will fix that problem for us. So there our normal applies appropriately. And if we go to our Texture, we can see that that has been switched over to a normal map. Now, what I could do is I could grab my material and drag and drop that onto any object that I want. And you can see a preview of that in. And then whenever you want to drop that, you simply release the left mouse button, and it will leave that material in that place. Now, you'll also notice that on your Material, with it selected, you have the capabilities of adjusting the tile. So if I come in, I can adjust my tiling-- two by two, and let's actually do two by two there. And I could also do this for my Normal Map. So you always want to make sure that you are adjusting this accordingly. Sometimes it could look a little off if your Diffuse and your Normal Map are not tiled in conjunction with one another. So now, we talked about creating materials and what to watch out for when creating materials in Unity. Now, what I want to do is I want to show you how to use the materials that you can create inside of what's called Substance Designer. So to bring in a Substance Designer material, what we'll want to do is right click on our folder that we want it to come into nx import the object. So let's Import New Asset. And I'm going to go to Unity for Referenced files, and then Substance Designer files. If you're wondering what Substance Designer is, Substance Designed is a texture creation software. And it's really intuitive. It's a node-based texture creation software. And we have an [? entero ?] course on that software if you want to learn how to use it. I really recommend it, because it's very, very powerful in the game pipeline, because what we can do is we can create textures in Substance Designer. And we can expose variables, things like adjusting the overall dirt on a texture, and we can expose that inside of Unity. And all I have to do is change it in Unity instead of going into Photoshop and adjusting the look of it and then re-saving it, re-exporting it, re-importing it to Unity. It really just saves a lot of time. Now, I'm going to be using Substance Files for materials just because I like working with them so much. So with this, you'll see that I have Substance Designer files. And I'm going to go ahead and go to Rock, and I'm going to import this file. So it's an SBSAR. Now, if you don't have Substance Designer, this should work OK. Unity should recognize it. Now, if it's not recognizing it, you can go to Algorithmic's website for Substance, and you can download the Substance Player. And that will allow you to view these Substances. So I'm going to go ahead and import this. And you'll notice that it comes in as a material. And with it selected, we get a little bit of a different interface in our Inspector. You'll notice here that it will give me a list of the different materials in the Substance. And it automatically hooks up all the textures and everything that I've set up in Substance Designer already. So now, all I have to do is drag this material from the Inspector onto my surface. And you can see that applied there. So with this, you can see that I have my stone floor. It's got a Normal Map applied to it. And I could go ahead and apply the same thing to the top here. Now, notice that dragging it from here is not working. And again, that's just something that's with Substance. So you want to select that from the Inspector and drag it on there. Let's go ahead and import our wall material. So I'm going to right click Import New Asset. And this is going to be called Wood Planks. We're just going to import that. And then I'm going to drag and drop that on to my walls. And there we go. So now, I have the skeletal framework of some sort of mineshaft here. So we've got rock ceilings, rock floors, and then we've got some planks going across the walls, things like that. So now that we have this started, what we're going to do in our next lesson is we're going to be assembling our level. So I'll see you 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.
Introduction and Project Overview
1

Introduction and Project Overview

 
01:14
Breaking down the interface
2

Breaking down the interface

 
10:59
File management and project organization
3

File management and project organization

 
10:45
Creating prefabs
4

Creating prefabs

 
10:41
Creating materials
5

Creating materials

 
10:00
Assembling the level
6

Assembling the level

 
08:36
Set dressing the level
7

Set dressing the level

 
14:09
Adding lights
8

Adding lights

 
09:55
Baking lightmaps
9

Baking lightmaps

 
11:32
Creating particle systems
10

Creating particle systems

 
11:19
Working with physics
11

Working with physics

 
09:41
Getting started with scripting
12

Getting started with scripting

 
09:41
Creating the player spawn controller
13

Creating the player spawn controller

 
11:10
Finishing the player spawn controller
14

Finishing the player spawn controller

 
08:12
Creating the game state script
15

Creating the game state script

 
11:46
Scripting the HUD
16

Scripting the HUD

 
13:16
Creating items in Unity
17

Creating items in Unity

 
13:35
Creating the lantern functionality
18

Creating the lantern functionality

 
18:32
Loading levels
19

Loading levels

 
08:08
Publishing our game
20

Publishing our game

 
08:46