Hi @WBagley ,
Sorry for the delayed reply! I think my e-mail notifications are not setup correctly, so I didn’t see this particular issue.
To try and answer your question, ImportAndPostProcessOutOfDateAssets does a bunch of things:
- Compile Scripts
- Import Assets
- PostProcessAllAssets
- Others (that we can skip for now).
In those 3 first points, there is a possibility to hook into Unity’s code execution during user callbacks (i.e.
CompilationPipeline.assemblyCompilationStarted , AssetPostprocessor.OnPreprocessAsset, AssetPostprocessor.OnPostprocessAllAssets to name a few). and during those callbacks, code is allowed to do “whatever it wants” which can be troublesome, since this is supposed to be a pretty hot path, and if code in any of the callbacks invoked enumerates the entire project using something like AssetDatabase.FindAssets, time spent waiting for a Refresh will increase.
The way to debug it further is to do a Deep Profile, and see if any of the code reported under ImportAndPostProcessOutOfDateAssets is running inside any of the libraries for which you have source code for and can modify (or upgrade those libraries to a new version, if the address the issue you’re seeing). There are naturally some pieces of code that you just can’t modify (i.e. Unity’s own source code), but many times a long time can be spent in Asset Store plugins, certain packages, etc. which you could modify and optimize. Happy to share some tips, in case you have more data (and you can always DM me in case the info is sensitive).
Let me know if this helps you move forward, and also, there’s another active thread where we acknowledge that this is a big deal that we need to fix across teams within Unity: Improving iteration time on C# script changes