EditorWindow Showing Message When Application Playing

On a custom EditorWindow. How can I detect if the Application is Playing in time to clear the window a write a message on it to say something like “Editor Not Available When Application Playing”?. That way the user does not try to make changes while the application is plying.

I tried this:

public void OnGUI()
{
if (EditorApplication.isPlaying)
{
Debug.Log (“Playing”); //See if this gets called.
}

}

But OnGUI does not get called once the Application Starts Playing.
I also tried Checking in the Update() call. That does get called but then I can’t make calls to GUI calls to add a GUILayout.Lable outside the OnGUI. What else could I do?

Thanks

private bool editorEnabled = true;

void Update()
{
   // If playing, sets editorEnabled to false.
   editorEnabled = !EditorApplication.isPlaying;
}

void OnGUI()
{
   if (editorEnabled)
      // Draw GUI
   else
      ShowNotification(new GUIContent("Editor is not available while playing!"));
}

That should do it.

Once again Eddyjsut want I needed. Thanks so much !