Hello guys, I have a shader that I wrote and it renders fine on my mac. However when I build my app and run it on mobile, everything in the scene that uses my shader is invisible. Like its not rendering them. What have I done wrong?
Shader "UnlitColor" {
Properties {
_Color("Color", Color) = (1,1,1,1)
}
SubShader {
Pass {
Tags { "LightMode" = "ForwardBase" "Queue" = "Opaque" }
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
fixed4 _Color;
fixed4 _LightColor0;
struct vertexInput {
fixed4 vertex : POSITION;
fixed3 normal : NORMAL;
};
struct vertexOutput {
fixed4 pos : SV_POSITION;
fixed4 posWorld : TEXCOORD0;
fixed3 normalWorld : TEXCOORD1;
};
vertexOutput vert(vertexInput v){
vertexOutput o;
o.normalWorld = normalize( mul( fixed4( v.normal, 0.0), _World2Object ).xyz );
o.posWorld = mul(_Object2World, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
fixed4 frag(vertexOutput i) : COLOR {
fixed3 diffuse = saturate( dot( normalize( i.normalWorld ), normalize(_WorldSpaceLightPos0.xyz)) * 0.5 + 0.5);
diffuse = _LightColor0.rgb * diffuse.rgb * _Color.rgb;
return fixed4(diffuse, 1.0);
}
ENDCG
}
}
}
Note: I added a fallback but that didn’t solve it.
Using a nexus 4