Unexpected . expecting ) error for dot product

Hello

I have an error with my shader, but am unsure how to fix it.

I am trying to get the angle between the camera direction, and the normal direction. And if the angle is above a certain amount make the albedo red, else use the texture.

But i get this error on the creation of the dot product line:

Unexpected token ‘.’. Expected: ‘(’

Here is the surface function, input struct and my defined variables:

    struct Input {
        float2 uv_MainTex;
        float2 uv_BumpMap;
        float3 viewDirection;
    };
 
    // variables
    sampler2D MainTex;
    sampler2D BumpMap;

    void surf(Input IN, inout SurfaceOutput output){
        // error is on this line for some reason
        float dotProduct = dot( output.Normal.xyz, Input.viewDirection.xyz );

        float normalLength = length( output.Normal );
        float viewLength = length( Input.viewDirection );
        float angle = dotProduct / ( normalLength * viewLength );

        if(angle > 20){
            output.Albedo = (1,0,0,0);
        }
        else {
            output.Albedo = tex2D(MainTex, Input.uv_MainTex).rgb;
        }
        output.Normal = UnpackNormal( tex2D (BumpMap, Input.uv_BumpMap));
    }

I don’t understand what is wrong with my syntax, can any one help explain my mistake?

Everywhere you have “Input” in the surf function replace with “IN”.

Ah of course, damn VS intellisense or lack of is so annoying. For some reason it highlighted IN blue as if it was a data type.