Is there a callback that can be executed when any EditorWindow is opened and closed? I want to make a “Recently Opened Windows” tool under Editor, when closing any window inherited from EditorWindow, record the window, and dynamically generate a MenuItem, so that the user can conveniently re-open the window through the MenuItem. Open the EditorWindow.
Now the implementation of dynamically generated MenuItem seems to refer to this thread implementation, the remaining question is how to know if a EditorWindow is closed.
GPT tells me to use UnityEditor.Callbacks.OnOpenAssetAttribute
. But this attribute seems only be called when opening an asset.