InspectorWindow.DrawEditors high CPU in Editor.

I have a script that is causing a huge amount of CPU usage in editor.

I’ve spent fair bit of time trying to diagnose what is causing this issue. I know it is coming from a custom script because it only happens when I have this particular gameObject selected in the scene, and the gameObject only has one script on it.

The script it a weather controller script in run time, but it can also be edited in the inspector which changed the lighting etc in the scene through the OnValidate() method. The weird part is there is no issues in run time. It is purely a editor performance issue.

I have tried putting this script into another scene to test and further diagnose the problem but it runs perfectly fine in that scene. As soon as I bring it back into the production scene I am getting terrible performance. The profiler looks like this

I can’t seem to find anything in the docs about these functions and/or googling comes to no end.

Does anyone have an idea what those functions are or know how to solve this kind of problem.

Any help would be much appreciated.

Thanks.

If you haven’t already, I recommend you try enabling the Deep Profile option in the Profiler window. It’s likely to over-inflate your performance problem, and may even slow things to a crawl, but if you can get even one usable sample it might give you more insight into what exactly is causing the issue.