Search Unity

Feedback InspectorMode not serialized when unity restarts - Regression

Discussion in 'Editor & General Support' started by Johannski, Jan 6, 2020.

  1. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    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:
    upload_2020-1-6_11-29-14.png

    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
    Code (CSharp):
    1. internal class InspectorWindow : EditorWindow, IHasCustomMenu
    2. {
    3.     public InspectorMode m_InspectorMode = InspectorMode.Normal;
    4.     ...
    5. }
    Unity 2019.3
    Code (CSharp):
    1. internal class InspectorWindow : EditorWindow, IHasCustomMenu
    2. {
    3.    InspectorMode   m_InspectorMode = InspectorMode.Normal;
    4.     ...
    5. }
    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
    Code (CSharp):
    1. internal class InspectorWindow : EditorWindow, IHasCustomMenu
    2. {
    3.    [SerializeField]
    4.    private InspectorMode   m_InspectorMode = InspectorMode.Normal;
    5.     ...
    6. }
    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?
     
    Last edited: Jan 18, 2020
    Peter77 likes this.
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Thank you, to whoever fixed this in the new unity version (I noticed it in 2021.1.5f1). You made me very happy!