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

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?

1 Like

Which version of Unity do you use? I believe this issue had been fixed since 2019.2

1 Like

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

1 Like

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.

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

1 Like

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.

1 Like

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!

1 Like

Happy outcome in the end! Looking forward to the silky smooth animations

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

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

the fix landed to Unity 2020.1.0a8 version

thank you for the info. Any plan to have it on 2019.4 LTS?