Search Unity

Monobehavior Inspector does huge amounts of work when collapsing/expanding components

Discussion in 'Editor & General Support' started by CianNoonan, Apr 2, 2020.

  1. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Clicking on the top bar of an MB component results in a long freeze of the editor. The stack trace shows that unity is doing huge amounts of work on click. Is there a way to reduce this?

    Almost 300ms on a Ryzen 2700x all to InternalEditorUtility.SetIsInspectorExpanded(). Is there a way I can reduce this in my project and is it possible that this can be fixed?
     

    Attached Files:

    alexeyzakharov likes this.
  2. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    418
    Which version of Unity do you use? I believe this issue had been fixed since 2019.2
     
    CianNoonan likes this.
  3. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    2019.3.7f1

    I'd be more than happy to try to replicate on a different version to help you track this down!

    Maybe it was worse pre-2019.2, I could potentially profile 2019.1 in the same situation and see if this is an improvement there. Either way it's still a hang on 2019.3
     
    alexeyzakharov likes this.
  4. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    418
    Thank you! The best way to help would be to file a bug with a repro project. In cases like this the key factor is scripts/packages setup - the attributes extractions and type comparisons are slow here and we need a real usecase which provides the measurable timings we can improve.
     
  5. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I have submitted a report under the email cian@brightrockgames.com. The report contains only the scripts and plugins folders of the projects, I'm guessing assets are not relevant. I really hope this real-world case is helpful for investigating this

    (Case 1240523) Monobehavior Inspector does huge amounts of work when collapsing/expanding components
     
    alexeyzakharov likes this.
  6. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Out of interest why does expand/collapse require such heavy work? It's something that if it wasn't so terribly slow I would click on very frequently so having it be so slow is pretty frustrating.

    The Unity QA Team declined the ticket, I'll see if it can be reopened.
     
    alexeyzakharov likes this.
  7. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    418
    Not cached data about components augmentation - various attributes or editors change the look of the inspector and acquiring this info is expensive (usually reflection).
    Thanks for the help - the issue had been fixed as a part of another bug and your project helped to verify it!
     
    CianNoonan likes this.
  8. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    Happy outcome in the end! Looking forward to the silky smooth animations
     
  9. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Could you please tell me from what version of Unity the fix is available? I'm on 2019.3.0f6 and the issue is still there.
    Thanks
     
  10. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I think it was a 2020 version. Maybe just make a bug report, the scripts were what was needed to replicate for me so I dropped them all into a new proj
     
  11. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    418
    the fix landed to Unity 2020.1.0a8 version
     
  12. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    thank you for the info. Any plan to have it on 2019.4 LTS?
     
unityunity