Shader Missing Semantics?

I’m getting two errors from my shader saying I’ve got missing semantics on line 103 and 118. What does this error mean? Here’s what the error messages say.

'vert': function return value missing semantics at line 103

'frag': input parameter 'i' missing semantics at line 118

I believe the lines that the error message are pointing to are incorrect. I think I’ve found the correct lines below marked with // Missing Semantics. What exactly is wrong with the code and how do I fix it?

        v2f vert (a2v v) // Missing Semantics
            v2f o;
            //Create a rotation matrix for tangent space
            //Store the light's direction in tangent space
            o.lightDirection = mul(rotation, ObjSpaceLightDir(v.vertex));
            //Transform the vertex to projection space
            o.pos = mul( UNITY_MATRIX_MVP, v.vertex);
            //Get the UV coordinates
            o.uv = TRANSFORM_TEX (v.texcoord, _MainTex); 
            o.uv2 = TRANSFORM_TEX (v.texcoord, _Bump);
            return o;

        float4 frag(v2f i) : COLOR // Missing Semantics
            //Get the color of the pixel from the texture
            float4 c = tex2D (_MainTex, i.uv); 
            //Merge the colours
            c.rgb = (floor(c.rgb*_ColorMerge)/_ColorMerge);

            //Get the normal from the bump map
            float3 n =  UnpackNormal(tex2D (_Bump, i.uv2));

            //Based on the ambient light
            float3 lightColor =;

            //Work out this distance of the light
            float lengthSq = dot(i.lightDirection, i.lightDirection);
            //Fix the attenuation based on the distance
            float atten = 1.0 / (1.0 + lengthSq);
            //Angle to the light
            float diff = saturate (dot (n, normalize(i.lightDirection))); 
            //Perform our toon light mapping
            diff = tex2D(_Ramp, float2(diff, 0.5));
            //Update the colour
            lightColor += _LightColor0.rgb * (diff * atten);
            //Product the final color
            c.rgb = lightColor * c.rgb * 2;
            return c;


Semantics defines how data fields in the shader code are bound to data channels on the hardware. Additionally, since vertex and fragment programs are run in different steps most hardware and languages will require any data passed between the programs to be bount to specific channels.

You code snippet is missing the v2f structure definition - my guess is you’re missing a semantics definition on one of the fields there.

( a semantic definition is the value specified after the field or method definition, in your case in frag() : COLOR you define you’re binding the result of your fragment operation to the color channel. Make sure you have such definitions for each field in your v2f struct )