Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

UI Bug 2021.2.0a17

Discussion in '2021.2 Beta' started by MaxWitsch, May 28, 2021.

  1. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    In 2021.2.0a17 after you recompile a script while having the Profiler open the Ui gets weird.
    The only way i could fix this, is by close and reopen unity.

    upload_2021-5-28_10-25-13.png
     
  2. Deleted User

    Deleted User

    Guest

  3. MaxWitsch

    MaxWitsch

    Joined:
    Jul 6, 2015
    Posts:
    114
    Yes, I tried to reload the Scene, and also tried to reload the Layout (upper right corner) unfortunately nothing worked.
    It seems there is a problem with the GUI system or the Profiler of Unity.

    It reminds me of when i accidentally overritten a builtin GUI style when trying to create a custom editor window. (Also recovered after restart)

    luckily this is nothing dangerous, its just a bit annoying.
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    Hi there,

    Sorry about that one, funky stuff going on with an EditorWindow's private field getting Serialized and Deserialized over Domain Reload and GUIConten.none getting contaminated this way. We've tracked this as case 1335130 and fixed it in 2021.2.0a18

    As a workaround, you can select nothingness in the CPU usage profiler module by e.g. clicking into empty space in Timeline view, and then trigger a Domain Reload, e.g. through a script change.

    Sidenote and my learning: never store global GUIContent or GUIStyles in private fields unless marked as [NonSerialized] (not even for initialization only). Ideally put them all in a private static class under your EditorWindow :)
     
    Last edited: May 28, 2021
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Ah, yes, Editor windows being helpful and making a best effort of serializing and deserializing all private fields on assembly reload.

    Probably the single feature in Unity that has caused us most headache!
     
  6. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    aye...

    it's just an innocuously looking

    Code (CSharp):
    1. GUIContent m_CachedSelectionString = GUIContent.none;
    2.  
    3. // ...
    4.  
    5. m_CachedSelectionString  = new GUIContent("Selected: ...");
    then serialization comes around, stores "Selected: ...", assigns GUIContent.none as reference, then fills it with the serialized value... :confused:
     
  7. mesmes123

    mesmes123

    Joined:
    Oct 11, 2021
    Posts:
    9
    The bug is still here [UNITY 2021.3.4f1]
    it is happening when opening a dropdown with just one item (index 0)... all the others items are fine (1,2,3...) but the first one can't be reached.
    Have a look:
     

    Attached Files:

  8. Skiriki

    Skiriki

    Joined:
    Aug 30, 2013
    Posts:
    69
    I'd wagger a guess that it's a separate bug. You might want to use the bug reporter in the editor menu to report it. It's under
    Help > Report a Bug