Conditionally skip a shader variant

Hi everyone.
So there’s no problem or bug here, but I’m just curious whether there exists a feature or workaround to do what I’m about to explain.
I have written this complex Shader with a lot of optional features, and sub-features. Currently I’m using #pragma multi_compile_local directives to compile my Shader and it’s working like a charm.
The thing is that my Sub-features depend on the feature itself being used, and when the main feature is not used the variants for the sub-feature are also being compiled. e.g.

#pragma multi_compile_local _ FEATURE1_MODE1 FEATURE1_MODE2
#pragma multi_compile_local FEATURE1_SUB1_OPTION1 FEATURE1_SUB1_OPTION2
#pragma multi_compile_local FEATURE1_SUB2_OPTION1 FEATURE1_SUB2_OPTION2 FEATURE1_SUB2_OPTION3

In the example above, _FEATURE1_SUB#OPTION# variants are never used when the feature itself is off (FEATURE1_MODE# are not active), or in some complex conditions e.g. SUB2 might not be used when the feature is set to MODE1, etc. etc.
But anyway, all those duplicate variants are being compiled I guess, which is a waste of Build-time !
As I said it’s working and not even that annoying, but is it possible to have some control over whether SUB features are even included based on current active variants ?
p.s. I tried #if and #ifdef directives a few months ago but they don’t work, it seems #pragma directives are processed before #if directives.

1 Like