- Home /
finding errors in compiled shader
When I have errors In my shaders I often get error messages referring to the generated shader code but the Open compiled shader just shows no shader code saying there was an error. Are there better ways than trial and error to debug this? Currently I have two error messages when using worldPos as input which completely make no sense an refer to the generated code.
I'm afraid this is out of my depth! Although, I agree that the shaderLab docs are much less in-depth than the rest of Unity.
Answer by ScroodgeM · Jul 20, 2012 at 07:53 AM
you can get error on compile stage (when you have for example a syntax error) - in this case compiler points you to the line it can't recognise.
but if you have a runtime error (e.g. it's compiled OK but can't be calculated due to some reason) - it can point you only to error line in compiled shader, not to source code.
you can use
#pragma debug
directive to add comments to compiled shader - this makes compiled shader more understandable and often helps to find a mistake.
Your answer
Follow this Question
Related Questions
Pass ShaderLab properties to Standard cginc 2 Answers
Multiply Shader with Alpha 0 Answers
Mobile Additive surface shader 0 Answers
Shader compiler: internal error compiling shader snippet type=0 platform=0: 1 Answer
Shadow Support in Custom Shader 0 Answers