/// <summary> /// Call this inside the OnGUI function of the class to check for any events. /// </summary> public void ProcessEvents() { var eventType = Event.current.type; if (_mouseEventMap.ContainsKey(eventType)) { _mouseEventMap[eventType].ForEach(x => x.InvokeSafe()); } if (eventType == EventType.KeyDown) { KeyPressed.InvokeSafe(new EditorKeyboardEvent()); // TODO: Replace with delete command. There is one...somewhere...apparently...*shrug* if (Event.current.keyCode == KeyCode.Backspace) { DeletePressed.InvokeSafe(); } } if (eventType == EventType.KeyUp) { KeyPressed.InvokeSafe(new EditorKeyboardEvent()); } MousePosition = Event.current.mousePosition; }