public void OnEnable() { hideFlags = HideFlags.HideAndDontSave; if (camera == null) { camera = new GraphCamera(); } if (selectionBox == null) { selectionBox = new GraphSelectionBox(); selectionBox.SelectionPerformed += HandleBoxSelection; } if (keyboardState == null) { keyboardState = new KeyboardState(); } if (cursorDragLink == null) { cursorDragLink = new CursorDragLink(this); cursorDragLink.DraggedLinkReleased += HandleMouseDraggedLinkReleased; } if (contextMenu == null) { contextMenu = new GraphContextMenu(); contextMenu.RequestContextMenuCreation += OnRequestContextMenuCreation; contextMenu.MenuItemClicked += OnMenuItemClicked; } RemoveGraphListeners(); AddGraphListeners(); InitializeNodeRenderers(); Undo.undoRedoPerformed += OnUndoRedoPerformed; }