public static BTEditorManager CreateInstance(BehaviorTree bt, BTAsset asset) { if (Manager == null) { Manager = (BTEditorManager)ScriptableObject.CreateInstance(typeof(BTEditorManager)); Manager.behaviorTree = bt; Manager.btAsset = asset; // When the user clicks on a node to select it, while viewing the behavior tree associated with a GO with a BehaviorTreeAgent component // we store the selection then switch the Unity Editor selection over to the appropriate BTAsset. Once the Manager for the BTAsset is // created (here!) we perform the original selection. if (QueuedSelectionFor == asset) { Manager.SelectNode(bt.GetNodeByGUID(QueuedSelectionGUID)); QueuedSelectionFor = null; QueuedSelectionGUID = null; } } return(Manager); }