- Home /
multiple shaders per shader file
I wanted to put a collection of different debug shaders into one debug.shader file but now get just a syntax error after the first shader. Alone both shaders compile correctly.
Is really only one shader per shader file allowed? Am I really supposed to have single shader files for 30 lines of shader code?! Where can I report this as a bug?
Answer by jonas-echterhoff · Sep 27, 2011 at 09:10 PM
Yes, each shader needs to go into it's own file. Why do you think that is a bug? Having multiple shaders per file would make asset management much more confusing.
Because I don't see any reason to forbid it and the shader syntax would support that. Why are more files with trivial shaders more manageable then fewer files? I think the opposite is true. It doesn't make sense to have several files for lots of 30 LOC shaders like DebugUv0, DebugUv1, DebugNormal, DebugLighting... The way to go would be one DebugShaders.shader.
I would just assign them by script when debugging. No need to put them into same shader, if I understand your debug idea correctly.
Answer by ToruTheRedFox · Jun 06, 2019 at 10:05 AM
it's possible in pure HLSL so I don't understand why it isn't in Unity
Your answer
Follow this Question
Related Questions
Change shader color for specific GameObject 1 Answer
UnityObjectToClipPos is inverted? 0 Answers
Unity 5 fragment shader that writes custom depth into the depth texture 1 Answer
How to use BRDF Shaders? 1 Answer
Camera culling problem 3D 0 Answers