OnSceneGUI stop been called after a generic script is updated

Hello guys,
I have an EditorWindow script which is attached to the onSceneGUIDelegate:

void Awake()
{              
    SceneView.onSceneGUIDelegate += this.OnSceneGUI;
}

void OnSceneGUI( SceneView sceneView )
{
    DrawCellCenterPoints(this._maze,_mazeMargin);
    DrawCellSelection();          
}

The code works fine and the OnSceneGUI is called, the problem is that as soon as I change some script in the project, even a blank line in a random script, the callback stop to be called.

To fix the problem I have to close the windows and reopen it again. I tried [this](Repainting an EditorWindow when it's not the current focus? - Questions & Answers - Unity Discussions but they) solution but it didn’t work.
Any Idea how to solve the problem without having to close and reopen the window every time? I’m quite new with editor scripting so maybe I’m missing something.

Found the solution:
Awake is not called after hot reloading. you can subscribe to the event in OnEnable and unsubscribe in OnDisable

an EditorWindow is a SerializableObject that persists through play/edit mode. Awake is only called when the window is created. But you figured that out already :slight_smile: If you look in the EditorWindow source code, you can see that the hideFlags are set to “DontSave”. That causes that :wink: