Unknown input semantics TEXCOORD/4

I’ve set

#pragma target 3.0

in the shader, but I cant get TEXCOORD4 to work. I get the following error when I add it to my shader. Its commented out in the code below, with or without doesn’t work. Is TEXCOORD4 allowed as an input? Its happy with it in just the v2f struct.

Shader error in 'Custom/TileRenderer': Vertex program 'vert': unknown input semantics TEXCOORD/4

What am I doing wrong?

Shader "Custom/TileRenderer" {
Properties {
	_MainTex ("Base (RGB)", 2D) = "white" {}
	_AlphaTex("Trans (A)", 2D) = "white" {}
	_OverlayTex("Trans (A)", 2D) = "white" {}
}

SubShader {
	Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
	LOD 100
	
	ZWrite Off
	Blend SrcAlpha OneMinusSrcAlpha 
	
	Pass {  
		CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			//#pragma target 3.0
			//#pragma multi_compile_fog
			#pragma debug
			
			#include "UnityCG.cginc"

			struct appdata_t {
				float4 vertex : POSITION;
				float2 texcoord : TEXCOORD0;
				float2 texcoord1 : TEXCOORD1;
				float2 texcoord2 : TEXCOORD2;
				float2 texcoord3 : TEXCOORD3;

				//as soon as I add TEXCOORD4 in the appdata_t struct
				//I get the shader compile error
				float2 texcoord4 : TEXCOORD4;

				//UNITY_VERTEX_INPUT_INSTANCE_ID
			};
			
			struct v2f {
				float4 vertex : SV_POSITION;
				float2 texcoord : TEXCOORD0;
				float2 texcoord1 : TEXCOORD1;
				float2 texcoord2 : TEXCOORD2;
				float2 texcoord3 : TEXCOORD3;
				float2 texcoord4 : TEXCOORD4;
			};

@gibber10 Were you able to figure this out? We’re seeing something similar.

As this is a top result when googling this issue, I’m answering this old question.

You can output more than 4 texcoords from your vertex function, but input can have not more than 4. I suspect (haven’t tested this) that it may also depend on if the model provides information for more than 4 texture coordinates, as IIRC you can export up to 9 uv sets, but that’s an assumption.

If you need different modified versions of your UV coordinates, you can input them as a single uv set (TEXCOORD) and output to different variables the modified versions, and pass them to fragment shader. This probably will cease the need for so many input TEXCOORDs.

Hope this will help someone!