/// <summary> /// Loads an asset tree from memory into a runtime copy /// </summary> /// <param name="node"></param> /// <returns></returns> private NPCNode LoadTree(NPCNode node, NPCBlackboard bb = null) { NPCNode parent = Instantiate(node); parent.Children.Clear(); if (node.Blackboard != null && node.Blackboard.Root == node) { bb = node.Blackboard; } foreach (NPCNode n in node.Children) { NPCNode child = LoadTree(n, bb); child.Blackboard = bb; parent.AddChild(child); } bb = null; parent.SetMainAgent(gNPCController); return(parent); }