Undeclared identifier UNITY_SETUP_INSTANCE_ID

IndentStampInc.cginc

v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord,_MainTex;
o.texcoord1 = _SourceTexCoords.xy + v.texcoord * _SourceTexCoords.zw;
return o;
}

It’s part of an include file which is included here:

Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include “UnityCG.cginc”
#include “IndentStampInc.cginc”

uniform float _Scale;
uniform float _HeightOffset;

fixed4 frag (v2f i) : SV_Target
{
fixed4 stamp = tex2D(_MainTex, i.texcoord);
fixed4 surface = tex2D(_SurfaceTex, i.texcoord1);
float buildUp = clamp(stamp.r - _HeightOffset, 0, 1);
float indent = clamp(stamp.r - _HeightOffset, -1, 0);
return fixed4(surface.rgb + surface.rgb * buildUp + indent.rrr * _Scale, stamp.a);
}
ENDCG
}

What’s going wrong? I looked it up in the documentation and it says it has to be used at the beginning of a vertex program. That’s all the details that are there and it looks like this example is using it at the beginning of a vertex program. I’m wondering if it’s messing up because it’s including the file and there’s no CGPROGRAM semantics in the include file. But I guess it might not matter because the CGPROGRAM semantics are before the include statements.

What version of Unity are you using? You need to be using 5.4 or newer for instancing, which is what that macro is for.

Thank you, that’s fixed the issue. I was using 5.3.3…