Unity 2017.3b功能预览:程序集定义文件和转换工具

As the release of Unity 2017.3 is drawing near, we’d like to show you two nifty features that you might like.

随着Unity 2017.3版本的临近,我们想向您展示您可能喜欢的两个漂亮功能。

The first feature is Assembly Definition Files. With this feature, you’ll get the option to define your own managed assemblies inside a folder. With well-defined dependencies you’ll ensure that only the required assemblies will be rebuilt, when you make a change in a script, reducing compilation time.

第一个功能是程序集定义文件。 使用此功能,您将可以选择在文件夹内定义自己的托管程序集。 使用定义明确的依赖项,您可以确保在脚本中进行更改时仅重建所需的程序集,从而减少了编译时间。

The larger your project grows, the greater the compilation time will inevitably end up being. When iterating on a project this can easily become a nuisance,  so setting up proper assembly definition files should help you work more efficiently and waste less time waiting for scripts to compile.

您的项目规模越大,编译时间就不可避免地越长。 在项目上进行迭代时,这很容易成为麻烦,因此设置适当的程序集定义文件应有助于您更有效地工作,并减少等待脚本编译的时间。

The second feature is the new Transform Tool. The Transform Tool is a mix of the three current tools; Move, Rotate and Scale suitable for those situations, where easy access to all three is required. A small thing, but also a potential time saver.

第二个功能是新的转换工具。 转换工具是三个当前工具的组合。 移动,旋转和缩放适用于需要轻松访问这三个位置的情况。 小事情,但也可能节省时间。

You can test out the above features (and more) right now while waiting for the full release of Unity 2017.3, by simply downloading the 2017.3 beta here. Remember to take backups before upgrading your project.

您可以在等待Unity 2017.3完整版的同时立即测试上述功能(以及更多功能),只需 在此处下载2017.3 beta 。 在升级项目之前,请记住进行备份。

脚本编译–程序集定义文件 (Script Compilation – Assembly Definition Files)

Unity automatically defines how scripts compile to managed assemblies. Typically, compilation times in the Unity Editor for iterative script changes increase as you add more scripts to the Project. When you are going through an iterative process you want the builds to compile as fast and smooth as possible.

Unity自动定义脚本如何编译为托管程序集。 通常, 随着您向 项目中 添加更多脚本,Unity编辑器中用于迭代脚本更改的 编译 时间会增加 。 在进行迭代过程时,您希望构建尽可能快且平稳地进行编译。

You can use an assembly definition file to define your own managed assemblies based upon scripts inside a folder. If you separate Project scripts into multiple assemblies with well-defined dependencies, you’ll ensure that only required assemblies are rebuilt when making changes in a script. This reduces compilation times, so you can think of each managed assembly as a single library within the Unity Project.

您可以使用程序集定义文件根据文件夹内的脚本定义自己的托管程序集。 如果将Project脚本分​​成具有明确定义的 依赖关系的 多个程序集,则将 确保 在脚本中 进行 更改 时仅重建所需的程序集 。 这减少了编译时间,因此您可以将每个托管程序集视为Unity项目中的单个库。

The figure above illustrates how you can split the Project scripts into several assemblies. If you are only changing scripts in Main.dll, none of the other assemblies will need to recompile. Since Main.dll contains fewer scripts, it also compiles faster than Assembly-CSharp.dll.

上图说明了如何将Project脚本拆分为几个程序集。 如果仅在Main.dll中更改脚本,则其他任何程序集都不需要重新编译。 由于Main.dll包含的脚本较少,因此它的编译速度也比Assembly-CSharp.dll快。

Similarly, script changes you make in Stuff.dll will only cause Main.dll and Stuff.dll to recompile.

同样,您在Stuff.dll中进行的脚本更改只会导致Main.dll和Stuff.dll重新编译。

如何使用程序集定义文件 (How to use assembly definition files)

Assembly definition files are Asset files that you create by going to Assets > CreateAssembly Definition. They have the extension .asmdef .

程序集定义文件是您通过转到资产 > 创建 > 程序集定义 创建的资产文件 。 它们具有扩展名 .asmdef。

You can add an assembly definition file to a folder in a Unity Project to compile all the scripts in the folder into an assembly, and then set the name of the assembly in the Inspector.

您可以将程序集定义文件添加到Unity项目中的文件夹中,以将该文件夹中的所有脚本编译为程序集,然后在检查器中设置程序集的名称。

Note: The name of the folder in which the assembly definition file resides and the filename of the assembly definition file have no effect on the name of the assembly.

注意: 程序集定义文件所在的文件夹的名称和程序集定义文件的文件名对 程序集的名称无效。

Add references to other assembly definition files in the Project using the Inspector too. The references are used when compiling the assemblies and define the dependencies between the assemblies.

也可以使用检查器在项目中添加对其他程序集定义文件的引用。 编译程序集时使用引用,并定义 程序集 之间 的 依赖关系 。

Unity uses the references to compile the assemblies and also defines the dependencies between the assemblies.

Unity使用引用来编译程序集,并定义 程序集之间的 依赖 关系。

You can set the platform compatibility for the assembly definition files in the Inspector. You have the option to exclude or include specific platforms.

您可以在检查器中为程序集定义文件设置平台兼容性。 您可以选择排除或包括特定平台。

文件夹层次结构中的多个程序集定义文件 (Multiple assembly definition files inside a folder hierarchy)

If you have multiple assembly definition f

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值