- Home /
 
               Question by 
               BuzzardMercure · Oct 12, 2017 at 03:31 AM · 
                scripting problemmaterialprogrammingsharedmaterial  
              
 
              Why isn't (.)sharedMaterial sharing this change to "_EmissionColor"?
 public class Example_EmissionShare : MonoBehaviour {
 
     public bool shareEmit = true;
     private Material originalMat;
     private Renderer rendertarget;
     
     // Use this for initialization
     void Start () {
         
         rendertarget = GetComponent<Renderer>();
         originalMat = rendertarget.material;
 
     }
 
     // Update is called once per frame
     void Update () {
         Color rand = Random.ColorHSV();
         
         originalMat.SetColor("_EmissionColor", rand);
         rendertarget.sharedMaterial.SetColor("_EmissionColor", originalMat.GetColor("_EmissionColor"));
 
 
     }
 }
               Comment
              
 
               
              I'm using the standard shader. The "Pilot" object is changing it's emission color just fine at play time, but the changes (are not) being reflected in other users of the material.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                