Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Kelvin 2 · Feb 05, 2010 at 04:57 PM · shadercgcompiling

How to force the compilation of a shader in Unity?

From time to time when writing shaders with CG language in it I get normal errors like syntax errors or some others that everyone makes during normal coding, but sometimes Unity stops recompiling my shaders and keeps a older version compiled ("Open Compiled Shader" option) and does not recompile it until I erase completely the shader and the material assigned and create it from zero with the same shader code.

Is there a way to force a recompilation of the shader? Maybe erasing something in the Assets folder or any other place?

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

5 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Aras · Jun 30, 2010 at 06:08 AM

Does right clicking on the shader and doing "Reimport" help?

Comment
Add comment · Show 1 · 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 Kelvin 2 · Jul 10, 2010 at 05:57 PM 0
Share

Yes

Thank you.

avatar image
3
Best Answer

Answer by Kelvin 2 · Jul 10, 2010 at 06:00 PM

Right click the file and Select "Reimport", this is the solution provided by the Unity team.

Comment
Add comment · 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
0

Answer by andeeee · Feb 09, 2010 at 05:00 PM

Does this happen when you open the file from the text editor's recent items menu, or when you open the file from the desktop? Unity doesn't always track files if they weren't opened from within Unity. Try closing open shader files and reopening them from Unity.

Comment
Add comment · Show 1 · 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 Kelvin 2 · Feb 10, 2010 at 03:46 PM 1
Share

I did opened them from Unity, the only thing that does the trick according to the Unity $$anonymous$$m themselves is to right click the shader file in Unity and "Reimport" them.

avatar image
0

Answer by lgarczyn · Mar 19, 2020 at 11:53 PM

Since this is a popular question, I'll add another possibility:

Two shaders can share the same name, with no warning from Unity. Make sure you are editing the correct shader.

Comment
Add comment · 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
0

Answer by randomdragon · Aug 30, 2021 at 01:31 PM

THIS WON'T WORK for a compute shader file that includes only constant variables data. Such a data file won't recompile even if you reimport it. The only way to update this kind of file that I find for now is to explicitly change the name of the variable you use in both the compute shader and data file and save them. I suppose this is a unity bug that needs fixing.

My unity version: 2020.3.12f1c1

Comment
Add comment · 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

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

2 People are following this question.

avatar image avatar image

Related Questions

Cg Language incompatibility Desktop VS GLSL Android 0 Answers

Can anyone help me with reflective shader with fall off property? 0 Answers

Sprite deformation in shader? 0 Answers

unity_LightmapMatrix in Cg ? 1 Answer

Shader: get nearest point light's color, direction and general custom lighting questions 0 Answers


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