title: Update Shader on Runtime in Unity
body: <p>I have an object which has a diffuse shader and on runtime I want the shader to switch to Diffuse Always Visible but this should trigger only if the unit is behind a specific object within the layer named obstacles.</p>
  
  <p>First I tried to switch the object shader with the following code and the shader is changed in the inspector but not in the game during play. I tried placing and calling the shader from the resources and also created seprate materials but its not working.</p>
  
  <p>Here is the code I am using in C#</p>
  
  <pre><code>Unit.renderer.material.shader = Shader.Find("Diffuse - Always visible");
  </code></pre>
  
  <p>As for the rest I was thinking of using a raycast but not sure how to handle this.</p>
  
  <p>Thanks in advance</p>