Parse Error: Syntax Error TOK_COLOR vs TVAL_COLOR?

I have an error in a shader that I was learning on about. I wanted to recreate a Blinn-Phong shader. but I have This problem.

Code:

Shader "Compendium/BasicBlinn"
{
    Properties
    {
        Color("Color", Color) = (1,1,1,1)
        SpecularColor("Spec Color", Color) = (1,1,1,1)
        Specular("Specu;ar", Range(0,1)) = 0.5
        Gloss("Gloss", Range(0,1)) = 0.5
    }
        SubShader
    {
        Tags
    {
        "Queue" = "Geometry"

    }
        CGPROGRAM
        #pragma surface surf BlinnPhong

        float4 Color;
        half Specular;
        fixed Gloss;

        struct Input
        {
            float2 uv_MainTex;
        };

        void surf(Input IN, inout SurfaceOutput o)
        {
            o.Albedo = Color.rgb;
            o.Specular = Specular;
            o.Gloss = Gloss;
        }
        ENDCG
    }
        FallBack "Diffuse"
}

The error is the following:

Shader error in 'BasicBlinn': Parse error: syntax error, unexpected TOK_COLOR, expecting TVAL_ID or TVAL_VARREF at line 5

line 5 being Color(“Color”, Color) = (1,1,1,1)

I don’t know how to solve this because I’m new to Shading, but if someone could tell me what is wrong here?

Color and Specular as property names conflict with some built-in parsing types that’s causing an error. Change them to _Color and _Specular, ideally start all your top level properties with underscore as common naming convention.

Like:
_Color("Color", Color) = (1,1,1,1)
_Specular("Specular", Range(0,1)) = 0.5

Also there’s a semicolon in the string description for your Specular property. It shouldn’t cause a compile issue but just pointing it out.

2 Likes

Thank you, it worked perfectly. Thank you for that rule of thumb for the naming convention.

I got this error as well, and the cause of mine was, I forgot the another double quote (") at the end of the shader name… so stupid…