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
}
}
}