- Home /
 
               Question by 
               Kyozumo · Jul 25, 2014 at 09:40 PM · 
                c#shadergameobjectmaterial  
              
 
              How to apply a shader to all materials inside a gameobject
Oi Mates!
so, i have an axe i've modeled inside 3d Max, i've exported it with the textures to Unity.

So, i've tried applying shaders using:
 gameObject.renderer.material.shader = Shader.Find("DDD");
But the Shader(DDD) would only appear in one of the textures.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Graham-Dunnett · Jul 25, 2014 at 09:42 PM
A Renderer can have multiple materials. Iterate over it's materials array and set the shader you need on each material. 
Your answer
 
 
             Follow this Question
Related Questions
How to create a complex material in an Editor-Script? C# 0 Answers
Why does IsSleeping() keep returning false? (Billiard Logic) 0 Answers
C# Gameobject's Script's ValuesEquals Other Gameobject's script's Values 1 Answer
adding animation dynamically by script 0 Answers
Null Reference Exception Error(Solved) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                