UnityEditor.MenuItem.editorModes, what are they?

UnityEditor.MenuItem has a field called editorModes which is an array of strings. The documentation on this is classically poor stating: “Specifies the Editor modes that the item is displayed for. If you don’t specify any Editor modes, the item is only displayed for the default mode.”

Does anyone know what these editor mode values are and what they do?

Well, this list of strings is a very recent addition. The exact usage is not really clear to me. I looked through some editor code with ILSpy and it seems the only currently valid “mode” is “default”, at least I haven’t found anything else. It seems to be related to the class “ModeService” which was deliberately excluded from the docs. At least that’s how the class is defined.

The majority of that class is internal at the moment. Maybe it’s intended to provide a customizable mode system so we can switch the editor into custom modes (a bit like the Tools, but maybe on a larger scale).

Though at the moment we simply don’t know its actualy purpose. As I said this was a very recent addition. When I looked in my ILSpy (where I had only loaded the UnityEditor.dll of Unity 2020) the editorModes field did not exist back then. So I would suggest to just ignore it for now.