Editor Taking Long Time to Compile Scripts

So I’ve been using Unity for 3+ years and ever since day one, Unity has taken about 10 seconds to update changes in editor when I update code. I’ve seen that most people I’ve seen on YouTube can compile scripts in under 2 seconds (granted they’re using Unity Pro/Plus whilst I’m using Personal). Is there a reason for why my scripts have always taken long to compile? Could it be an editor setting?

Thanks!

Odds are the youtubers just have a much better computer than you have, though at times they could use some movie magic to speed things up.

If you have a lot of code you can use an .asmdef to speed things up. Unity - Manual: Assembly definitions

It’s not based on my computer. I have a decent PC and Unity and project files are on SSD (which I had hoped would speed it up). I’ve gone through a few computers over the years and loads have always been the same. And it’s not even much code. I can make a 1 line script and remove one semicolon and it’ll still take 10s to process the change.

That SSD should help, though CPU is probably more relevant. My main point was not to insult your computer, but to say that comparing your speed to the youtuber’s is probably a recipe for disappointment due to sped up vid’s or ultra-high-end boxes. There are some settings that could affect compile time (scripting backend, platform, etc.), but most are probably set to whatever you need them to be for your game. Thus they wouldn’t be very convenient to try to toggle as needed. I don’t think there are any reasons being free vs plus/pro would affect your compile time.

Of note, in most situations, the compile time won’t overly be affected by the size of the change. One line change, or one hundred, will usually be about the same. What matters more (usually) is the total size of the code in the changed assembly. That’s why the asmdef’s can help (especially if you have large third party code blobs you never touch).

One additional thing that could be causing you trouble is [InitializeOnLoad] attributes. Those technically are triggered right after the compile, but I believe anything you do to measure compile time will include those calls.

good luck

Thank you for all the info! I appreciate it! :slight_smile: