I have a shader with subShaders when lightmap is on and off:
Shader "Alpha Blending Light=Off, Cull=Off, ZWrite=Off" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Pass {
Tags { "LightMode"="Vertex"}
Lighting Off
Cull Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {}
}
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Pass {
Tags { "LightMode"="VertexLMRGBM"}
Lighting Off
Cull Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {}
}
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Pass {
Tags { "LightMode"="VertexLM"}
Lighting Off
Cull Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {}
}
}
}
When lightmap is on, it appears Unity picks up the first lightmap subshader, whether it is compatible or not with the current target platform. Here is what I have:
-
When the subshader with the pass tagged as “LightMode”=“VertexLMRGBM” is first in the shader, it works on Web player but not on iOS (objects on which the shader is applied to are disappearing both from the Editor and the build).
-
When the subshader with the pass tagged as LightMode"="VertexLM is first in the shader, it works on iOS but not on the Web player.
How to write properly the shader so that it is compatible both for Web player and iOS?