0
\$\begingroup\$

I was in the process of creating a function in my compute shader that converts a 180° angle to a 360° CCW angle like this:

// Calculates the 360° angle counter-clock-wise
float angle360(in float2 a, in float2 b)
{
    float angle = angle180(a, b);
    // Right hand rule: When b is to the left of a, a x b points up -> take the "opposite" of the 180° angle in the 360° "space"
    if (cross(float3(a, 0), float3(b, 0)).z > 0)
        angle = 360 - angle;
    return angle;
}

But when I went back to the Unity Editor it complained to me that there was a "unrecognised identifier 'INVALID_UTF8_STRING' at kernel CSMain" on line 1

When I deleted the comments the error went away, and it doesn't happen with any other comment, only these, and they are also the only ones that contain the ° character. So my question is, why doesn't the shader compiler (I assume) like that I use this character?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

The issue was with the encoding of the file, as it was not encoded in UTF8. Setting it to the UTF8 encoding in VS solved the issue.

If you want to know how to set the encoding in a file in VS, follow this tutorial here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .