简体   繁体   English

如何改善统一的构建时间?

[英]How to improve build times on unity?

I remember vaguely that i once saw an article about improving build times with the use of assembly files being built separatly and something about namespaces dividing the project to parts that will be compiled separatly.我依稀记得我曾经看过一篇关于通过使用单独构建的程序集文件来改善构建时间的文章,以及一些关于将项目划分为将单独编译的部分的名称空间的文章。
again some about ASM files.又是一些关于 ASM 文件的内容。

I can't find it anywhere.我到处都找不到。 anyone know?有人知道吗?
Build times are killing my pace, i need to speed up.构建时间正在扼杀我的步伐,我需要加快速度。
any help will be appreciated任何帮助将不胜感激

Although you said build times.虽然你说的是构建时间。 As you mentioned assembly definitions I will assume that you are referring to compile time and domain reload time.正如您提到的程序集定义,我假设您指的是编译时间和域重新加载时间。

Depending on your project Unity can generate up to 4 different assemblies for you.根据您的项目,Unity 最多可以为您生成 4 个不同的程序集。 By dividing up your codebase into custom assemblies and not relying on the assemblies to be generated by Unity you can decrease the amount of code needed to recompile through incremental compilation.通过将您的代码库划分为自定义程序集而不依赖于 Unity 生成的程序集,您可以减少通过增量编译重新编译所需的代码量。 However this will not reduce domain reload time which is the usual culprit for high "compile times".然而,这不会减少域重新加载时间,而域重新加载时间通常是高“编译时间”的罪魁祸首。

In order to reduce your domain reload time it is best to check what is causing your high domain reload times with the Editor Iteration Profiler .为了减少域重新加载时间,最好使用Editor Iteration Profiler检查导致域重新加载时间过长的原因。 You can also start having a look at scripts that use InitializeOnLoad since that also gets called every time the domain is reloaded.您还可以开始查看使用InitializeOnLoad的脚本,因为每次重新加载域时也会调用它。

Some resources that expand upon what I mentioned:一些资源扩展了我提到的内容:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM