Advertisement
Cookie042

SceneView Hotkeys

Sep 14th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using UnityEditor;
  2. using UnityEngine;
  3.  
  4. [InitializeOnLoad]
  5. public static class SceneViewKeybinds
  6. {
  7.     static SceneViewKeybinds()
  8.     {
  9.         SceneView.onSceneGUIDelegate += OnSceneGui;
  10.     }
  11.  
  12.     private static void OnSceneGui(SceneView sceneview)
  13.     {
  14.         DetectBinds();
  15.     }
  16.  
  17.     private static void DetectBinds()
  18.     {
  19.         if (Event.current != null && Event.current.isKey)
  20.         {
  21.             Debug.Log(Event.current);
  22.  
  23.             EventModifiers mods = Event.current.modifiers;
  24.  
  25.             if (Event.current.keyCode == KeyCode.H
  26.                 && mods == EventModifiers.Control
  27.                 && Event.current.type == EventType.KeyDown)
  28.             {
  29.                 Debug.Log("ctrl+H was pressed DOWN in the editor");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement