It seems #pragma don’t work in included files, I am curious if anyone found a workaround? Right now I have to type the same set of #pragma in multiple shaders.
It’s probably worth reporting this as a bug.
So far it hasn’t affected me yet, because I keep them all in the same file as the specific pass, because they tend to be different between passes anyway.
For example:
Pass{
Name "FORWARD"
Tags { "LightMode" = "ForwardBase"}
Blend SrcAlpha OneMinusSrcAlpha // Alpha Blend for soft shorelines
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 5.0
#pragma exclude_renderers opengl
#pragma multi_compile_fwdbase nolightmap nodirlightmap
#define UNITY_PASS_FORWARDBASE
#include "ComplexWater.cginc"
ENDCG
}
This means that each pass defines #pragma vertex vert, even though it’s shared between passes, but it does immediately give you a good overview of what that pass is for.