- Home /
 
 
               Question by 
               U_Ku_Shu · Nov 28, 2016 at 06:30 AM · 
                shadertransparencyalphamobile devicesalpha-channel  
              
 
              Change alpha in runtime of gameObject with mobile shader
So I have any GameObject with assigned mobile shader with transparency support.
I need to do sth like:
 void SetAlpha(float a)
 {
     var oldCol = _renderer.material.color;
     
     _renderer.material.color = new Color(oldCol.r, oldCol.g, oldCol.b, a);
 }
 
               to make gameObject semi-transparent. But exactly for mobile shader. But mobile shaders have noColor param =(
Material doesn't have a color property '_Color' UnityEngine.Material:get_color()
error is shown
               Comment
              
 
               
              Looks like no $$anonymous$$obile shader allows transparency. Try the Std Shader with Transparency mode.
 
               Best Answer 
              
 
              Answer by Bunny83 · Nov 28, 2016 at 07:33 AM
That's the point of the mobile shaders. They don't have the color property which most shaders usually have to avoid the overhead since it isn't required in most cases. If you need it, just use the normal transparent shader.
Your answer