x


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?

more ▼

asked Feb 05 '10 at 04:57 PM

Kelvin 2 gravatar image

Kelvin 2
1 2 2 5

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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

more ▼

answered Jun 30 '10 at 06:08 AM

Aras gravatar image

Aras ♦♦
1.6k 7 26

Yes

Thank you.

Jul 10 '10 at 05:57 PM Kelvin 2
(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Jul 10 '10 at 06:00 PM

Kelvin 2 gravatar image

Kelvin 2
1 2 2 5

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Feb 09 '10 at 05:00 PM

andeeee gravatar image

andeeee ♦
1.4k 3 6 18

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

Feb 10 '10 at 03:46 PM Kelvin 2
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1650
x88
x70

asked: Feb 05 '10 at 04:57 PM

Seen: 3174 times

Last Updated: Feb 05 '10 at 04:57 PM