So it seems that if you try to use uv1 and uv2 in the same shader the compile will fail. The reason seems to be that in the compiled shader it names them with the same name. Heres some example code that will fail (although I have not actually tested this exact code).
Shader "Example/Diffuse Overlay" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_OtherTex("OtherTex", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uvCoords; //Builtin for uv1
float2 uv2Coords; //Builtin for uv2
};
sampler2D _MainTex;
sampler2D _OtherTex;
void surf (Input IN, inout SurfaceOutput o) {
float4 mainColor = tex2D(_MainTex, IN.uvCoords);
float4 otherColor = tex2D(_OtherTex, IN.uv2Coords);
o.Albedo = mainColor*otherColor;
}
ENDCG
}
Fallback "Diffuse"
}
this code also seems to fail(the difference is within the Input struct).
Shader "Example/Diffuse Overlay" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_OtherTex("OtherTex", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
float2 uv2_OtherTex;
};
sampler2D _MainTex;
sampler2D _OtherTex;
void surf (Input IN, inout SurfaceOutput o) {
float4 mainColor = tex2D(_MainTex, IN.uv_MainTex);
float4 otherColor = tex2D(_OtherTex, IN.uv2_OtherTex);
o.Albedo = mainColor*otherColor;
}
ENDCG
}
Fallback "Diffuse"
}
This must be a compiler bug unless Im missing something. I filed a bug with another example shader. The case number is 369318.