In Unreal’s material editor (shader editor) there is the ability to define a StaticBool parameter that allows you to set a per-“material instance” (what unity calls materials) boolean that you can branch on without any performance impact as it’s compile-time.
Is there any way we can do this with shader graph so that we can switch on and off features per-material without having to create a new shader soley for that purpose?
What you are looking for is called a shader variant in Unity. I was never in need of this feature and haven’t used ShaderGraph a lot. However according to this forum thread the current Unity version should support keywords and shader variants in shader graph.
I am not sure if I got you right, but if did then you want to create Branch node where you can connect any created Boolean in shadergraph to Predicate field and by switching the Boolean state it will enable/disable related features connected with True and False fields.
The only thing that you should keep in mind that in order to switch the Boolean through script you must treat it as float, not boolean. Like this:
material.SetFloat("Boolean name", 1f);
Code above will switch Boolean to true.
If you change 1f to 0f then it will be switched to false.
I hope it helps.