Unity Editor Event System

So I am trying to look into playing around with the UnityEditor API to see about starting to develop plugins for my team, but have run into the issue where the Event.current is not doing the expected commandNames. Does any one else have this issue? Is there another way of hooking into the Editor Window to capture copy, deletes, moves etc. in the hierarchy. I have already looked at the docs and have called Event.current in OnInspectorGUI with no luck.

EventAPI

No, there’s no other way. What exact problem do you have? Keep in mind that certain events could already been processed / used by some built-in mechanics. The “type” of an event will turn into “Ignore” once the even has been used. However the Event class also has the undocumented “rawType” property which should keep it’s value even when processed.

Also you just said “EditorWindow”. Keep in mind that the Unity editor has several seperate editor windows. The Sceneview, gameview, inspector, console, animationeditor, profiler, … Those are all editor windows. Events are only set to the active editor window. If you want to get events while the sceneview is active you have to use the scene view gui callback. You have to subscribe a method to this delegate: SceneView.onSceneGUIDelegate. The method you would subscribe would look like this:

void OnSceneViewGUI(SceneView view)
{

}
//
SceneView.onSceneGUIDelegate += OnSceneViewGUI;

Don’t forget to unsubscribe when done. Usually you would use OnEnable to subscribe and OnDisable to unsubscribe.

If you need some general help with the IMGUI you may want to have a look at my IMGUI crash course ^^.