Repaint EditorSettings inspector from custom menu item

I want to combine a few settings from Edit > ProjectSettings > Editor in a custom menu item. My code works so far, but if I have the inspector window open, it does not reflect my changes until I close and reopen it.

How do I trigger a repaint on the EditorSettings inspector when I edit its settings from a menu item?

[MenuItem ("Tools/Set Remote")]
static void SetRemote()
{
	EditorSettings.unityRemoteDevice = "None";
	// Repaint the Edit > ProjectSettings > Editor inspector if open
}

5 years later, here is how you might do it.

Works for ProjectSettings editor window (but didn’t test on EditorSettings):


took this code from here


RepaintEditorWindow("ProjectSettingsWindow");//invoke like this.

static void RepaintEditorWindow(string name){
        var buildSettingsType = System.Type.GetType("UnityEditor."+name+",UnityEditor");
         var windows = Resources.FindObjectsOfTypeAll(buildSettingsType);
         if (windows != null && windows.Length > 0)
         {
             var window = (EditorWindow)windows[0];
             if (window)
                 window.Repaint();
         }
    }