Unity, please stop hurting my brain... "redefinition / undeclared"

Okay, I came to a really weird bug while creating a custom shader.
So what I wanted to achieve was to get a seprate uv set for the alpha channel, but it came to an end with a ping/pong’ing error

Shader "Standard (Decal Blend)" {
    Properties{
        _Color("Color", Color) = (1,1,1,1)
        _SpecColor("Specular Color", Color) = (.2,.2,.2,1)
        _MainTex("Albedo (RGB)", 2D) = "white" {}
        [Enum(UV0,0,UV1,1,UV2,2,UV3,3)] _UVPrim("UV Set for Blend", Float) = 0
        _Glossiness("Smoothness", Range(0,1)) = 0.5
        _SpecGlossMap("Specular", 2D) = "white" {}
        _Metallic("Metallic", Range(0,1)) = 0.0
    }
    SubShader{
        Tags{
        "RenderType" = "Opaque"
        "IgnoreProjector" = "True"
        "Queue" = "Geometry+1"
        "ForceNoShadowCasting" = "True" }
        LOD 200
        Offset -4, -4
        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows decal:blend vertex:vert

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0
        #pragma SHADER_API_XBOX360

        float4 _MainTex_ST; // error!

        sampler2D _MainTex;
        sampler2D _SpecGlossMap;

        struct Input {
            float2 uv_MainTex;
            float2 uv_BlendTex;
            fixed4 vertexColor;
        };

        half _UVPrim;
        half _Glossiness;
        half _Metallic;
        fixed4 _Color;

        // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
        // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
        // #pragma instancing_options assumeuniformscaling
        UNITY_INSTANCING_CBUFFER_START(Props)
        // put more per-instance properties here
        UNITY_INSTANCING_CBUFFER_END

        void vert(inout appdata_full v, out Input o)
        {
            UNITY_INITIALIZE_OUTPUT(Input, o);
            half2 buv = (_UVPrim == 0) ? v.texcoord : (_UVPrim == 1) ? v.texcoord1 : (_UVPrim == 2) ? v.texcoord2 : v.texcoord3;
            o.uv_BlendTex = TRANSFORM_TEX(buv, _MainTex);
            o.vertexColor = v.color;
        }

        void surf(Input IN, inout SurfaceOutputStandard o) {

            // Albedo comes from a texture tinted by color
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;

            // Metallic and smoothness come from slider variables
            fixed4 g = tex2D(_SpecGlossMap, IN.uv_MainTex) * _SpecColor;
            o.Metallic = g.rgb * _Metallic;
            o.Smoothness = g.a * _Glossiness;

            // Alpha blend
            fixed b = tex2D(_MainTex, IN.uv_BlendTex).a * _Color.a;
            o.Alpha = b * IN.vertexColor.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

So I need to add a _MainTex_ST for it to work, but when I do, I get this error:
Shader error in ‘Standard (Decal Blend)’: redefinition of ‘_MainTex_ST’ at line 84 (on d3d11)
and if I dont, I get this error:
Shader error in ‘Standard (Decal Blend)’: undeclared identifier ‘_MainTex_ST’ at line 54 (on d3d11)

So whats the case here? Where is it redefined? I dont even have a 84’th line in the code lol…

If you need to use TRANSFORM_TEX, then don’t define your uv using the magic “uv_” macro. It should just be “float2 _MainTex;” in your Input struct.

Also, you should make your UV selection switching be based on shader_feature switches instead of evaluating that constantly since it’s a rigid change.

You’re also going to run out of interpolators on target 3.0 when using appdata_full and defining extra samplers while using a surface shader. So you’ll either have to bump up to target 3.5 (which I’m not sure the 360 supports, but Unity doesn’t support 360 either so…), or you’ll have to manually define the input/output structs yourself and use vert/frag to limit what is being defined and reduce your interpolator count, but that will mean a lot more manual work. You could also just add “nodirlightmap” to your #pragma to get back a couple interpolators (would wouldn’t want to try and run dynamic light mapping on the 360 anyway). Then your shader should work.