InspectorMode not serialized when unity restarts - Regression

So there is this one minor thing, I’m quite annoyed about for a few years now, that was working in up to Unity 2017.4, but not in any newer versions. I just recently understood why, so I’m opening this thread in the hopes of getting a fix for the issue:

I really like having two inspector tabs open at all times, one with the normal inspector modde, and one with debug:

When having this setupand restarting Unity on version 5.6, the inspectors will keep their inspectormode. For all newer versions, the debug inspector will become a normal inspector as well.

And here is the cause for this:

Unity 5.6

internal class InspectorWindow : EditorWindow, IHasCustomMenu
{
    public InspectorMode m_InspectorMode = InspectorMode.Normal;
    ...
}

Unity 2019.3

internal class InspectorWindow : EditorWindow, IHasCustomMenu
{
   InspectorMode   m_InspectorMode = InspectorMode.Normal;
    ...
}

Looks like a small refactor change to make a cleaner API. The problem is, that the public scope also implicitly serialized the field (which makes it persist between unity sessions). So the refator I wish for is

Unity 2019.3

internal class InspectorWindow : EditorWindow, IHasCustomMenu
{
   [SerializeField]
   private InspectorMode   m_InspectorMode = InspectorMode.Normal;
    ...
}

That would add back the possibility to have Debug Inspector Windows in layouts that persist when restarting the editor.

Am I onto something here, or was this change made on purpose?

1 Like

Thank you, to whoever fixed this in the new unity version (I noticed it in 2021.1.5f1). You made me very happy!