This was copied from a very old post and I changed it to reflect this question. Haven't tested but should work.
var flowMachine = transform.AddComponent<FlowMachine>();
flowMachine.nest.source = GraphSource.Macro;
flowMachine.nest.macro = FlowMacro("flow macro name");
flowMachine.enabled = true
It doesn't work on Bolt 1.4.0f7, there's no "Instantiate" method on GraphNest.
Unless I'm mistaken, you shouldn't need Instantiate in 1.4, the macro change should be detected automatically.
Yes, no need doing flowMachine.nest.Instantiate(). I ended up using `flowMachine.nest.SwitchToMacro(flowMacro);`.
But I encountered another problem: changed flowMachine didn't respond to events. And I found a solution on a related question .
Customer support service by UserEcho