Is it possible to create a CG shader in its source text form at runtime and dynamically compile it for use?
I can’t see any suitable methods in the exposed shader class or can this only be done at build time in the asset pipeline?
Is it possible to create a CG shader in its source text form at runtime and dynamically compile it for use?
I can’t see any suitable methods in the exposed shader class or can this only be done at build time in the asset pipeline?
Use the first version of the Material constructor on this page:
http://unity3d.com/support/documentation/ScriptReference/Material.Material.html
(I’m not sure why it’s in Material instead of Shader)
As far as I know that only works with fixed function, not CG.
–Eric
Yes, it’s a little bit sad that you cannot create surface shaders from a string at runtime ![]()
But also selfexplaining as the various players can’t install the whole cg host on every place you drop them in, would be horrible for webplayer but especially mobile players
Ah thank you I didn’t see that
It doesn’t seem to say compiling with CG isn’t allowed either but I haven’t tried it yet…