A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Shaders' started by trad_emark, Jun 4, 2018.
Is it possible to define shader keywords in cginc shaders?
No, only the shader source itself is scanned.
Thanks for the answer. May I suggest to put this information into documentation?
Sure, I'll add it.
Does the unity standard shader dynamically add all of the multi compiles then, or how does that work? it is a bit tedious to add multi compiles to lots of shaders when we could just include the cginc.
Surface shaders add those when generating code, yes.
As of Unity 2020.2 it's possible to put #pragma directives in includes, but those have to be included using #include_with_pragmas directive. This also requires turning Caching preprocessor on in Editor project settings.
Wonderful! I'll keep that in mind for when we upgrade. Thanks Aleks!