- Home /
 
How to get Event.KeyboardEvent from non-focused EditorWindow?
Hey Guys,
I'm experimenting with editor-wide custom keyboard-shortcuts. My script inherits from no classes, using [InitializeOnLoad] and hooks into OnSceneViewDelegate. Mouse-events are only registered if the cursor is over the sceneview and keyboard-events are only registered if the sceneview has focus (was clicked in/on). "Layout"- and "Repaint"-events are always registered and OnSceneGUI IS called when I press any key, even if the sceneview has no focus, but the key is not registered. Any ideas on how to register the keyDown/keyCode/etc. from everywhere in the editor?
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEditor;
 
 [InitializeOnLoad]
 public static class customControls
 {
     static BlenderControls ()
     {
         SceneView.onSceneGUIDelegate -= OnSceneGUI;
         SceneView.onSceneGUIDelegate += OnSceneGUI;
     }
 
     static void OnDestroy ()
     {
         SceneView.onSceneGUIDelegate -= OnSceneGUI;
     }
 
     static void OnSceneGUI (SceneView sceneView)
     {
         Debug.Log (Event.current);
     }
 }
 
 
              desperate bump
I was able to focus the SceneView on $$anonymous$$ouseOver if there is currently no textfield edited and then register the keyboard input, but that is only a sub-optimal workaround... I'd like a more elegant solution.
Your answer