A Parameter Switch does it natively though. So you don’t necessarily need to write a custom.
Also. Your math seems wrong.
0x1 is 0, not 1. so essentially the effect is always off unless your if isn’t toggled at the same time.
if you just throw a boolean Parameter switch in there then you just get an option in every instance that actually recomputes the material each time.
which is basically your optimization. If you set it to off. It’s not compiled.
You can do similar with an IF inside a custom node.
actually. therea a particular way to do it. You can find it in the forum thread on here in which people complain of the fact that the default IF node loads both branches…