What would be the opposite of OnInspectorGUI?
**-EDIT-**
[I finally found a topic that talked about this issue! I knew I couldn't have been the only one.](https://discussions.unity.com/t/how-to-tell-in-an-editor-script-if-the-inspector-for-a-component-is-expanded/931787/5)
The steps are essentially as follows-
1. Subscribe to `EditorApplication.update` 2. In that subscribed function, call something like `var isOpen = InternalEditorUtility.GetIsInspectorExpanded(target);` 3. If isOpen is false, then you call your CloseEditor functions 4. Don't forget to Unsubscribe to `EditorApplication.update` in that closing function
**-Original-**
My custom inspector needs to be able to tell when the Inspector is no longer focused or "minimized".
OnDisable or OnDestroy only work when you completely select a new object.
Kind of like how OnDrawGizmosSelected knows if the object is opened and selected, I want to know if the object is NOT opened and selected.
Does anyone know how to implement this kind of functionality?
To put in an example-
Open

Closed

I want to be able to call a function when the component is being closed. I'm using a custom inspector already for the component, I just don't know how to detect when it is closed.