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.

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.