Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Reflection;
- using UnityEditor;
- using UnityEngine;
- public static class Test
- {
- static Test()
- {
- FieldInfo globalEventHandler = typeof(EditorApplication).GetField("globalEventHandler", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
- if (globalEventHandler != null)
- {
- MethodInfo method = typeof(Test).GetMethod("HandleKeyboardInput", BindingFlags.Static | BindingFlags.NonPublic);
- if (method != null)
- globalEventHandler.SetValue(null, Delegate.Combine((Delegate)globalEventHandler.GetValue(null), Delegate.CreateDelegate(globalEventHandler.FieldType, null, method)));
- }
- }
- private static void HandleKeyboardInput()
- {
- Debug.Log(Event.current);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement