- Home /
Applying an instance of a material to a cube
I am new to Unity and was going through the tutorial videos on scripting. The first one shows that in Mesh Renderer a material by the name Default Diffuse(Instance) is applied on the cube. It is seen at 1:33 and later time.
I tried doing that in Unity 4.2 but couldn't find how to apply an instance of material to the cube. How can that be done?
Answer by BrigadeJosh · Sep 20, 2013 at 05:38 PM
Ok, in the editor this time.
If you have a material created already in your project window, the simplest way is to drag and drop that material directly onto the object. You can drag it onto the object in the scene view, or you can drag it over the object's name in the Hierarchy window.
If you want/need to be more specific about the material's placement: Click on the object in the scene view or the hierarchy, and it's information will pop up in the inspector window. From there, find the "Materials" field on the MeshRenderer like you saw in the video. Click that and it will drop down to show you "Element 0". You can either drag and drop your material onto that element 0, or click the small circle to the right and it will bring up a window where you can pick from any material available to the project.
I am assu$$anonymous$$g you mean in script, since you are talking about the scripting tutorial. Also, this is C#
No, I meant in the user interface. The video was about scripting but it was shown applied in the user interface. It wasn't shown how it was applied. Just that it was already applied.
Ah, ok, that was actually my first whole response. I deleted it when I reread the question and saw the scripting tutorial part again xD - I'll post up a new answer
I'm new to the answering forum, apparently I can't post 2 answers to the same question. So I just edited my answer above. Is that what you're looking for?
I knew how to apply a material to an object. The video shows that the material on the object is "Default Diffuse (Instance)". The Instance in the brackets got me confused. I was asking about that. If I apply a material on an object then when I change that object's material the same change will go to the original material's properties also. I wanted to know how to apply an instance of the material.
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
How can I set the material on an instance after creating it? 1 Answer
iTween vs GoKit 1 Answer
how do i create material instances without errors 4 Answers
Using Same FBX to load multiple, but want different Color Settings on each, how to do this? 1 Answer