Vertext program 'vert': Struct variable 'o' is ignored. error in 2017.3

Hi,
I’ve just upgraded my Unity from 2017.2.0f3 to 2017.3.0f3 and now I’m having an error on one of my shaders.

Error:
Vertex program ‘vert’: Struct variable ‘o’ is ignored. Only instancing constant buffers can have struct variables.

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "Custom FX/Glow FX" {
    Properties
    {
        _MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
        _MaskIntensity ("MaskIntensity", Float) = 1
        _CloudsTex ("Clouds", 2D) = "black" {}
        _CloudsScale ("Cloud Scale", Vector) = (1,1,0,0)
        _GradientTex ("Gradient Tex", 2D) = "black" {}
    }
   
    SubShader
    {
        LOD 200

        Tags
        {
            "Queue" = "Transparent"
            "IgnoreProjector" = "True"
            "RenderType" = "Transparent"
        }
       
        Pass
        {
            Cull Off
            Lighting Off
            ZWrite Off
            Blend One One

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            sampler2D _GradientTex;
            sampler2D _CloudsTex;
            float4 _MainTex_ST;
            float4 _CloudsTex_ST;
            half2 _CloudsScale;
            fixed _MaskIntensity;
   
            struct appdata_t
            {
                float4 vertex : POSITION;
                float2 texcoord : TEXCOORD0;
                fixed4 color : COLOR;
            };
   
            struct v2f
            {
                float4 vertex : SV_POSITION;
                half2 texcoord : TEXCOORD0;
                half2 texcoord1 : TEXCOORD1;
                half2 texcoord2 : TEXCOORD2;
                float4 texcoord_clouds : TEXCOORD3;
            };
   
            v2f o;

            v2f vert (appdata_t v)
            {
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.texcoord = v.texcoord;
                o.texcoord_clouds.xy = v.texcoord * _CloudsScale.x + frac(_CloudsTex_ST.xy*_Time.y);
                return o;
            }
               
            fixed4 frag (v2f IN) : COLOR
            {
                fixed mask = tex2D(_MainTex, IN.texcoord).r;
                fixed clouds = tex2D(_CloudsTex,IN.texcoord_clouds.xy);
                fixed disValue = saturate(mask*_MaskIntensity + ((clouds) * mask));
                fixed4 color = tex2D(_GradientTex, fixed2(disValue,0.5));
                return color;
            }
            ENDCG
        }
    }
}

You probably need to move “v2f o;” inside “v2f vert (appdata_t v)”.

Thanks! It worked and now the shader is working!

However, it now shows a different warning.

3333087--259915--upload_2017-12-25_8-4-9.png

I solved it when I replaced “v2f o;” with “v2f o = (v2f)0;”
Thank you for your help :slight_smile:

The warning that vert is not completely initialized is because you’re not initializing your
half2 texcoord1 : TEXCOORD1;
half2 texcoord2 : TEXCOORD2;

(and if you’re not doing anything with those two texcoords, you might as well delete them from your struct)