8

Unity3D研究院新方法加快代码编译速度(九十六)

 3 years ago
source link: https://www.xuanyusong.com/archives/4474
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Unity3D研究院新方法加快代码编译速度(九十六)

之前可以将核心框架代码放在Plugins目录下,只要不修改该目录下的代码,就不会造成重新编译从而加快编译速度。新版本的Unity引入了一个新概念,Assembly可以将目录下(包括子目录)下的所有cs代码编译成DLL,这样就可以进一步加快编译速度。

Create->Assembly Definition 可创建一个新的Assembly。如图,我们创建两个目录,分别在目录下放入Assembly,这样A、B脚本就会自动编译在对应的dll里,脚本面板中右边的filename能看到被打包到那个dll里面了。

外部的脚本都是访问到A_DLL和B_DLL,如果它俩内部需要相互访问,如图,可以在Refrerences绑定另外一个Assembly即可。

下面还有一个Test Assemblies,字面意思是勾选后表示这个DLL只在编辑模式下有效,如果没有被外部引用,打包后就会剥离掉。这个功能非常好,因为以前只有Editor下的代码才会被打包剥离掉,这样非Editor下的代码也可以选择性剥离掉,剩下的功能还有待测试。

作者:雨松MOMO
专注移动互联网,Unity3D游戏开发
捐 赠写博客不易,如果您想请我喝一杯星巴克的话?就进来看吧!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK