Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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,517
    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,371
    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,517
    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