• 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
3
Question by aayars · Jul 08, 2010 at 02:25 AM · shadertexture

[Unity3] How can I fix this shader 'texture' syntax error under 3.0?

Hi,

Test driving the 3.0 Beta here, hope it's okay to ask a bleeding edge question. I'm encountering the following error when trying to use the ForceField shader from the Wiki:

Shader error in 'Shield': GLSL vertex shader: ERROR: 0:289: 'texture' : syntax error syntax error at line 16 Shader error in 'Shield': Shader program had errors at line 17

The referenced code is:

 15       Pass {            
 16           CGPROGRAM
 17           #pragma vertex vert
 18           #pragma fragment frag
 19           #pragma fragmentoption ARB_fog_exp2
 20           #include "UnityCG.cginc"

Any pointers how I could get this working under 3.0? I checked the included docs, but the syntax still looks the same in there. I realize the syntax may be tentative and I might have to change it again, just want to get it working for the time being.

Thanks

Comment
Add comment · Show 1
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 Ricardo · Jul 08, 2010 at 07:31 AM 0
Share

$$anonymous$$, as a recommendation, unity3 is a better tag than beta, as it has long-term relevance.

1 Reply

· Add your reply
  • Sort: 
avatar image
6

Answer by aayars · Jul 08, 2010 at 02:31 AM

Ack, I just needed to stare at the error longer.

Seems that "texture" is a keyword now. It is used as a variable name later in the shader. I changed the variable name, and it now compiles fine.

I withdraw this question :-)

Comment
Add comment · Show 3 · 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 Ricardo · Jul 08, 2010 at 07:28 AM 1
Share

Actually let it remain, as it will be useful for others. Have an upvote for researching your own problem ins$$anonymous$$d of sitting around waiting for a reply. :-)

avatar image qJake · Jul 08, 2010 at 07:52 AM 2
Share

Be sure to checkmark your answer in 48 hours, so people know you solved your problem. :)

avatar image Aras ♦♦ · Jul 11, 2010 at 11:22 AM 0
Share

"texture" is not a keyword per se, but becomes a keyword when shader is compiled into OpenGL ES 2.0 for iPhone/Android (which is on by default). You could add "#pragma exclude_renderers gles" to your shader to make it not compile into that target if you're sure you won't need it.

But yeah, probably best to avoid na$$anonymous$$g variables "texture".

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How can i get mixed texture from one shader and set it for another object with another shader? 0 Answers

Change between 2 textures based on a variable 1 Answer

Rendering a G-Buffer for a cubemap 0 Answers

Blending normal texture and texture made with shader 0 Answers

(c#) Transparency Problem - Toggle not Gradient 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