I’m putting together an editor extension and I need to call some code when the delete key is pressed. Unfortunately, the Unity editor is catching that event before it reaches my code. Here is what I have so far:
[CustomEditor(typeof(MyObject))]
public class MyObjectEditor : Editor {
public void OnSceneGUI() {
if (Event.current != null &&
Event.current.isKey &&
Event.current.type.Equals(EventType.keyDown) &&
Event.current.keyCode == KeyCode.Delete) {
//Delete code here
}
}
}
Anyone know any tricks?