- Home /
Shader error in ... : Syntax error at line 30
I created a custom shader in which I use the command
#include "../cginc/CustomParallax.cginc"
right after the CGPROGRAM directive, but once I click save and compile the shader, it gives me this weird error, while if I remove that line, it works perfectly and it compiles my shader. Could someone explain me what's wrong with this statement?
Thanks, this error is driving me mad >.<
Answer by HarshadK · Sep 26, 2014 at 01:50 PM
You might want to provide the full path in your include like:
#include "Asset/Path/cginc/CustomParallax.cginc"
Since looks like the ../is causing the error.
yea, I tried this method, too, but it still gives me that strange error. I noticed the problem is in the include part, when it has to open the include file. In fact it seems as if the file is somehow corrupted, even if I tried copying and pasting the code in other files and I still get the error. This is really weird...
It gives me the error "Syntax error at line 30". However, I noticed that I get no error copying the functions present in the cginc file and pasting them into the shader, that's quite strange. Also the error "Syntax error" seems to be quite generic, and it is related to this line of code
//Include the Custom Parallax helper file
#include "../cginc/Parallax.cginc"
And I get the same error with both absolute and relative path...
PS I am using monodevelop to edit the code of both shaders and cginc files, saving them with UNICODE(UTF-8) character encoding.
Try copying and pasting your .cginc file in either Notepad or Notepad++ and then save that file. Looks like some unwanted characters are added into your .cginc file that is causing this error.
Your answer
Follow this Question
Related Questions
cross product in cg shader - error "can't find __getVectorIndex" 1 Answer
Problem with custom shaders (surface function error) 0 Answers
Parse error: Syntax Error in compiled shader, Unity 4.3.1 [free] 1 Answer
Shader compiler error - failed to read correct magic number 2 Answers
Profile does not support "for" statements and "for" could not be unrolled. 1 Answer