///Utility to start sub graph (makes instance, writes mapping, starts graph and on stop reads mapping) public static bool TryStartSubGraph(this IGraphAssignable assignable, Component agent, System.Action <bool> callback = null) { assignable.currentInstance = assignable.CheckInstance(); if (assignable.currentInstance != null) { assignable.TryWriteMappedVariables(); //we always start with the current graphs blackboard parent bb as the subgraphs parent bb assignable.currentInstance.StartGraph(agent, assignable.graph.blackboard.parent, Graph.UpdateMode.Manual, (result) => { if (assignable.status == Status.Running) { assignable.TryReadMappedVariables(); } if (callback != null) { callback(result); } }); return(true); } return(false); }