title: Standard shader will change from "Opaque" to "Transparent" at runtime but won't show any changes. Why?
body: <p>It DOES change when I click on the dropdown box in the inspector, but that's worthless in an actual game. I'm guessing that I need to do something in my code to "refresh" the shaders but I can't figure out what that is.</p>
  
  <pre><code>public void MakeMaterialsTransparent () {
  
      // get all of the materials in an array
      Material[] materials = gameObject.GetComponent&lt;Renderer&gt;().materials;
      Material[] newMats = new Material[materials.Length];
      for (int i=0; i&lt;materials.Length; i++) {
  
          // copy the material
          newMats[i] = new Material(materials[i]);
  
          // set alpha for transparency
          newMats[i].color = new Color(newMats[i].color.r, newMats[i].color.g, newMats[i].color.b, 0.78f);
  
          // This SHOULD change the material to transparent
          // but it only works when I look at it in the inspector
          newMats[i].SetFloat("_Mode", 3);
  
      }
  
      // set the materials to the new array
      gameObject.GetComponent&lt;Renderer&gt;().materials = newMats;
  }
  </code></pre>