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/Unity.app/Contents/MonoBleedingEdge/bin/mono
Arguments: ‘/Applications/Unity2017/Unity.app/Contents/MonoBleedingEdge/lib/mono/4.5/mcs.exe’ @Temp/UnityTempFile-fb6ecf7e66ae44152851b203d443c3ff
index: 85
Responsefile: Temp/UnityTempFile-fb6ecf7e66ae44152851b203d443c3ff Contents:
-debug
-target:library
-nowarn:0169
-langversion:4
-out:‘Temp/Assembly-CSharp.dll’
-unsafe
-r:‘/Applications/Unity2017/Unity.app/Contents/Managed/UnityEditor.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/Managed/UnityEngine.dll’
-r:‘Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/Timeline/RuntimeEditor/UnityEngine.Timeline.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll’
-r:‘/Applications/Unity2017/Unity.app/Contents/UnityExtensions/Unity/UnityPurchasing/UnityEngine.Purchasing.dll’
-r:‘Assets/FacebookSDK/Plugins/Facebook.Unity.dll’
-r:‘Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll’
-r:‘Assets/Plugins/Photon3Unity3D.dll’
-r:‘Assets/Plugins/UnityChannel/ChannelPurchase.dll’
-r:‘Assets/Plugins/UnityChannel/UnityStore.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Editor.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Purchasing.Common.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Stores.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Apple/Apple.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Facebook/FacebookStore.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Security/live/Security.dll’
-r:‘Assets/Plugins/UnityPurchasing/Bin/Tizen/Tizen.dll’
-r:‘Assets/Plugins/UnityPurchasing/winrt/winrt.dll’
-r:‘Assets/Plugins/WebSocket/websocket-sharp.dll’
-r:‘Assets/UnityAssets/AmplifyColor/Plugins/AmplifyColor.dll’
-r:‘Assets/UnityAssets/AstarPathfindingProject/Plugins/Clipper/Pathfinding.ClipperLib.dll’
-r:‘Assets/UnityAssets/AstarPathfindingProject/Plugins/DotNetZip/Pathfinding.Ionic.Zip.Reduced.dll’
-r:‘Assets/UnityAssets/AstarPathfindingProject/Plugins/Poly2Tri/Pathfinding.Poly2Tri.dll’
-r:‘Assets/UnityAssets/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll’
-r:‘/Applications/Unity2017/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll’
-r:‘/Applications/Unity2017/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Common.dll’
-define:UNITY_5_3_OR_NEWER
-define:UNITY_5_4_OR_NEWER
-define:UNITY_5_5_OR_NEWER
-define:UNITY_5_6_OR_NEWER
-define:UNITY_2017_1_OR_NEWER
-define:UNITY_2017_1_1
-define:UNITY_2017_1
-define:UNITY_2017
-define:UNITY_PURCHASING
-define:UNITY_ANALYTICS
-define:UNITY_ADS
-define:ENABLE_AUDIO
-define:ENABLE_CACHING
-define:ENABLE_CLOTH
-define:ENABLE_GENERICS
-define:ENABLE_PVR_GI
-define:ENABLE_MICROPHONE
-define:ENABLE_MULTIPLE_DISPLAYS
-define:ENABLE_PHYSICS
-define:ENABLE_RUNTIME_NAVMESH_BUILDING

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?