Script compile take so long time

Hi everyone,

After i change a script and return Unity Editor, it takes so long time to finish recompile the script.
It takes about 2 minutes, this is terrible.

I dont know when i get this trouble, maybe after i update new version of Unity IAP then it alert need update something then i click “Go Ahead”.

this Unity Editor log when i recompiling the script.
It stuck at “Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll” for a long time, about 2 minutes.

Refresh: detecting if any assets need to be imported or removed …

Hashing assets … 0.002 seconds
file open: 0.000 seconds (2 files)
file read: 0.002 seconds (0.003 MB)
hash: 0.000 seconds
----- Compute hash(es) for 1 asset(s).

Refresh: elapses 0.489672 seconds
Updating Assets/Scripts/GameController/DialogController/RankingDialog.cs - GUID: cbc9af290c43947ffa2233d136cbe177…
done. [Time: 65.871205 ms]
Refreshing native plugins compatible for Editor in 2.57 ms, found 2 plugins.
Preloading 1 native plugins for Editor in 0.41 ms.

----- Total AssetImport time: 0.473855s, AssetImport time: 0.355585s, Asset hashing: 0.002086s [2.9 KB, 1.365381 mb/s]

  • Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll

-----Compiler Commandline Arguments:
Filename: /Applications/Unity2017/
Arguments: ‘/Applications/Unity2017/’ @Temp/UnityTempFile-fb6ecf7e66ae44152851b203d443c3ff
index: 85
Responsefile: Temp/UnityTempFile-fb6ecf7e66ae44152851b203d443c3ff Contents:

Please help me, i can working with this trouble :frowning:

How many scripts are in your project (including 3rd party products and Standard Assets)? If your project is big (hundreds of files) it’s normal that compilation takes a while. Now think of those poor programmers who waited 20 minutes for their C++ code to compile a few years back working on giant pieces of software. :wink:

You can reduce compilation times by splitting your code into multiple assemblies, which can be compiled on their own. In the past this was possible in a limited way via special folders like Plugins vs Editor, but in the current Unity version we can use Assembly Definition Files.

Thank you so much for your suggestions!
I’ve tried to create a new project. Copy everything in assets folder to the new project, but the Scripts folder i copied from old version (which have not updated by API updater) and it does not get this trouble, but when i copy Script folder from the newest version (which have updated by API updater) then i get this trouble again.
Maybe API Updater has updated something in my scripts and cause this trouble.

Hi, thanks for your answer.
My project has about 200 scripts, but this trouble happened after I import new Unity IAP (after i updated Unity IAP, it alert that need update API, then i click “Go Ahead”). And the nightmare started here :(.
Maybe the updating API causes this trouble?