Changing Editor scripts is so slow.

Been doing some editor scripts in 2023.2 Alpha and its so painful. In previous versions of Unity you change a line in a editor script switch back to Unity and a second later the script is compiled and you can see the change, but now its change a single line in a simple editor script, switch back to Unity and 20 to 30 seconds later Unity has finished compiling the script, after reloading the domain, completing domain (takes most of the time), loading back end, repainting everything. Is there some option I can set so only the editor script that is changed gets compiled instead of having to rebuild everything?

1 Like

Log a bug. If this is confirmed then the devs will fix it because iteration time regression is on the red list.

Most cases of “recompiling scripts is slow” that I’ve seen are because there’s something else in the project that does “a bunch of work” whenever scripts are recompiled. Editor Iteration Profiler (GitHub - Unity-Technologies/com.unity.editoriterationprofiler: Assists in capturing frames from the Profiler of Domain Reloads in the Unity Editor. Compatible with Unity 2019.3+.) typically can show where that script recompile & domain reload time goes. Often points to surprising places.

2 Likes

Think this was broken in 2020 and 2021 also. In 2019 editor scripts were fast.

2 Likes

There are hardly any scripts in the project so doubt it is that.

You’d be surprised: tons of things that used to be in the c++ core were moved to c# and slow things down. Really what Aras recommend and what I recommend are the best course of action because this isn’t supposed to get worse.

Huh? Yes it is. As has been stated multiple times, as more and more code gets moved to C# there is increasingly more stuff that need to be recompiled and assemblies to be reloaded and stuff to be done, so Unity will keep getting worse in this area with each yearly release.

400ms for just repainting toolbar? Is that a normal thing? total iteration time 12 second and deep profile not enabled.


is 400ms just for this or there is another “toolbar”?

EDIT: Looks like its not special to 23.2

I just finished trying my current work project and a blank project in alpha 12. Entering play mode took 3 seconds, exiting play mode took 300 milliseconds, and script compilation took 6 seconds. Repainting the toolbar took 100 milliseconds. Project uses URP and is just shy of 21GB (16GB project plus 5GB library).

Unity 2021.3.15 is the release used for the project. Entering play mode took 2.7 seconds, exiting play mode took 260 milliseconds, and script compilation took 6.5 seconds. Repainting the toolbar took 80 milliseconds.

I’m happy to see that script compilation is a little faster for the alpha. Meanwhile I couldn’t care less about the time to enter and exit play mode as disabling domain reloads causes enter time to drop down to the same few hundred milliseconds as exit time. I almost always keep them disabled if I can.

My work project isn’t taking advantage of anything that could improve performance either like asmdefs. If I took the time to set them up I’d see a significant performance increase as an empty project compiles scripts in half the time.

2 Likes

So it is normal if you don’t compare it to 2019.4 :smile:

Empty Project except editor profiler package, all packages removed. Built-in packages not disabled. empty scene, same layout same panels, same backend.

2019.4 total 3408ms

23.2 (probably same on 22 and 21 too) total 5060ms

What kind of fancy things added to ui repainting since 19.4 that makes it %100 slower ?

So arguments about “editor is slower because we added tons of functionality on c# side” not telling full story after all since there is 50 percent more iteration time with empty project.

2 Likes

My company needs features not higher editor performance. :stuck_out_tongue: