public void OnEnable() { Debug.Log("TreeEditorWindow.OnEnable()"); name = "UBonsai Editor"; _commandHistory = new CommandHistory(false); _historyWindow = new CommandHistoryWindow(GenerateWindowID()); _historyWindow.CommandHistory = _commandHistory; _currentTree = new BehaviourTreeBlueprint(); _currentTree.CommandHistory = _commandHistory; _currentTree.SelectionChanged += SelectionChanged; }
public void OnDisable() { Debug.Log("TreeEditorWindow.OnDisable()"); if (_currentTree != null) { _currentTree.SelectionChanged -= SelectionChanged; _currentTree.CommandHistory = null; _currentTree = null; } if (_historyWindow != null) { _historyWindow = null; } if (_commandHistory != null) { _commandHistory.Dispose(); _commandHistory = null; } }