- Home /
              This question was 
             closed Oct 10, 2014 at 02:15 AM by 
             Kirbyrawr for the following reason: 
             
 
            The question is answered, right answer was accepted
Change all color materials from a model
Okey , first this is my script:
 shadow.material.color = color2;
 shadow2.material.color = color2;
 shadow3.material.color = color2;
 shadow4.material.color = color2;
 shadow5.material.color = color2; 
It works , but the face and the other side of the model , didn't change. I add a image for explain 
 
                 
                sin título.png 
                (182.7 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by ThermalFusion · Sep 13, 2012 at 10:52 PM
I suppose that model has several materials attatched. You will have to use Renderer.materials to acess them all: http://docs.unity3d.com/Documentation/ScriptReference/Renderer-materials.html
 // C#
 Renderer rendererToEdit; // The renderer you wish to edit materials on
 foreach (Material mat in rendererToEdit.materials) {
     mat.color = Color.red;
 }
 //js
 var rendererToEdit : Renderer; // The renderer you wish to edit materials on
 for(var mat : Material in rendererToEdit.materials) {
     mat.color = Color.red;
 }
Yes , but i don't know how to use it , and the script is attached in other place
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                