Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by cod · Sep 26, 2014 at 01:40 PM · errorshadercompilercgcompile errors

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 >.<

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cod · Sep 30, 2014 at 07:01 AM 0
Share

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...

avatar image HarshadK · Sep 30, 2014 at 07:31 AM 0
Share

What error are you getting?

avatar image cod · Sep 30, 2014 at 01:36 PM 0
Share

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.

avatar image HarshadK · Sep 30, 2014 at 01:49 PM 0
Share

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.

avatar image cod · Sep 30, 2014 at 04:03 PM 0
Share

I did so, but the error persists...

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges