Define shader_feature inside .shader file

I have a custom vert/frag shader with various shader features which I can turn on and off, lets call this “shader A”.

I want to write another shader (“shader B”) which uses a pass from shader A, but with one of the shader features turned on.

I could write a custom editor for shader B that makes sure this feature is always turned on, but this seems annoying since I ALWAYS want this keyword turned.

I feel like I should be able to do something like:

#define SHADER_FEATURE

UsePass “ShaderA/PassIWantToUse”

but it never seems to work.

You could try adding this in the properties section;

[HideInInspector][Toggle(SHADER_FEATURE)] _Feat ("", Int) = 1.0

Just replace the SHADER_FEATURE with whatever the name of your keyword is. Now, this is technically writing a custom editor, however it’s doing it within the shader, so there shouldn’t be much of a problem.