x


List built-in shaders in inspector

I have a variable,

public var shader: Shader;

and it lists all custom shaders in the dropdown in the inspector, but not the built-in ones. Is it possible to include those or find all of them somehow?

/P

more ▼

asked Mar 10 '10 at 04:26 PM

metervara gravatar image

metervara
171 10 12 20

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

2 answers: sort voted first

As far as I'm aware, the only way to include them in your list would be to actually include copies of them in your project.

That's not such a difficult task though, simply download the Unity Shader Source Files and put them into a folder somewhere in your assets folder.

I've only briefly tried this to check that they actually do show up before posting this answer though, so there may be unintended side-effects - particularly if you make changes to any of the shaders. The reason being, because these imported shaders have the same name as the built-in shaders, they override the actual built-in shaders in your project (including the terrain shaders, particle shaders, etc) so any changes you make to these files in your project might have corresponding side-effects wherever the built-in shaders were used before!

Also, I think it may be the case that all the imported shader files will be included in your build, whether they are actually referenced or not (much like your script files), however they are relatively small so it wouldn't be much of filesize burden.

Anyway, hope this is enough of a solution for your needs :)

more ▼

answered Mar 10 '10 at 05:29 PM

duck gravatar image

duck ♦♦
41k 92 148 415

That would indeed work. I ended up doing a php shell script that auto generates a script with an enum containing all shader names.

Mar 29 '10 at 10:24 AM metervara
(comments are locked)
10|3000 characters needed characters left
more ▼

answered Mar 21 at 03:17 AM

jasperstocker gravatar image

jasperstocker
16 1

(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:

x1667
x468

asked: Mar 10 '10 at 04:26 PM

Seen: 2755 times

Last Updated: Mar 21 at 03:17 AM