自定义构建_在实验室中:自定义构建配置

自定义构建

“In the Labs” is a series of blog posts that put focus on features that have been prototyped internally but are experimental in nature and are not guaranteed to be included in Unity.

“在实验室中”是一系列博客文章,着重介绍了内部已原型化但本质上是实验性且不能保证包含在Unity中的功能。

In this issue of “In the Labs” we’ll have a look at an experimental feature that introduces user-defined custom build configurations. The idea is that custom defined build configurations replace the fixed set of target platforms, and the things you used to be able to specify per target platform can be specified per build configuration instead.

在本期“实验室中”中,我们将介绍一个实验性功能,该功能介绍了用户定义的自定义构建配置。 这个想法是,自定义定义的构建配置将替换目标平台的固定集,而您以前能够针对每个目标平台指定的内容可以改为针对每个构建配置进行指定。

This way it’s possible to specify more than one build configuration for the same platform; for example one for iPhone and one for iPad, or one for regular desktop builds and one for Steam builds. These are not built-in options to choose from; rather each build configuration is defined and named by the user and there is no limit to the number of them.

这样,可以为同一平台指定多个构建配置。 例如,一个用于iPhone,一个用于iPad,或者一个用于常规桌面版本,另一个用于Steam版本。 这些不是内置选项可供选择; 而是由用户定义和命名每个构建配置,并且对它们的数量没有限制。

自定义构建_在实验室中:自定义构建配置

Current build window to the left and prototyped build window to the right.

左侧为当前构建窗口,右侧为原型构建窗口。

支持继承 (Support for inheritance)

The custom build configurations support inheritance. One build configuration can inherit from another and only override select player settings.

定制构建配置支持继承。 一个构建配置可以从另一个构建配置继承,并且仅覆盖选择播放器设置。

This means it’s possible to define custom abstract parent build configurations, for example one shared by all builds for touch devices. All player settings common to these builds can be defined there once and for all instead of having to be duplicated for each build configuration.

这意味着可以定义自定义抽象父构建配置,例如所有触摸设备的构建共享的配置。 这些构建通用的所有播放器设置都可以在那里一劳永逸地定义,而不必为每个构建配置重复。

Build configurations can either be for a specific platform (e.g. iOS) or be abstract. To keep inheritance rules simple, only abstract build configurations can have child build configurations.

构建配置可以用于特定平台(例如iOS),也可以是抽象的。 为了简化继承规则,只有抽象构建配置可以具有子构建配置。

播放器设置集成到构建窗口中 (Player settings integrated into build window)

For each custom build configurations it’s possible to specify specific player settings. As part of making the player settings be per build configuration rather than per platform, the feature also includes the player settings inside the build window.

对于每个自定义构建配置,可以指定特定的播放器设置。 作为按构建配置而不是按平台进行播放器设置的一部分,此功能还包括构建窗口内的播放器设置。

The build window and player settings always had a special connection apparent from the button in the build window to open the player settings, and the new build window takes it a logical step further and includes them directly in the same window. The new build window shows the build configuration tree as a replacement for the Platform list, and has tabs for Build Settings, Player Settings, and Scenes in the build, for each build configuration. Like player settings, each build configuration can also override (or not) the list of scenes that are included in the build.

从构建窗口中的按钮打开播放器设置以来,构建窗口和播放器设置始终具有明显的特殊连接,新的构建窗口使逻辑设置更进一步,并将它们直接包含在同一窗口中。 新的构建窗口将构建配置树显示为平台列表的替代,并为每个构建配置提供了用于构建中的构建设置,播放器设置和场景的选项卡。 像播放器设置一样,每个构建配置也可以覆盖(或不覆盖)构建中包含的场景列表。

纹理覆盖 (Texture overrides)

In Unity it’s currently possibly to specify per-platform overrides in a texture, where the texture max-size or format can be overridden for certain platforms if desired. While not yet implemented in our experimental prototype, custom build configurations would provide the ability to specify these overrides per build configuration instead.  This would allow for example for a custom iPad build configuration to specify a higher max-texture sizes than in the abstract parent Touch Devices build configurations. Naturally each override is still optional.

在Unity中,当前可能在纹理中指定每个平台的覆盖 ,如果需要,可以在某些平台上覆盖纹理的max-size或format。 尽管在我们的实验原型中尚未实现,但是自定义构建配置将能够为每个构建配置指定这些替代。 例如,这将允许自定义iPad构建配置指定比抽象父级Touch Devices构建配置更高的最大纹理大小。 自然,每个替代仍然是可选的。

构建配置定义 (Build config defines)

Unity includes the ability to write code that’s only compiled for certain platforms using platform defines. Another feature that’s not prototyped yet, but has powerful potentials, is the use of build config defines, so each custom build configuration can have associated code that only applies for that configuration.

Unity包括使用平台定义编写仅针对特定平台编译的代码的功能。 尚未原型化但具有强大潜力的另一个功能是使用build config定义,因此每个自定义的build配置可以具有仅适用于该配置的关联代码。

简单的默认值 (Simple defaults)

By default when creating a new project, a set of build configurations are created out of the box. One configuration is created for each platform, and they all inherit from a common base build configuration. This means that the workflow can be just as simple as it is currently in Unity, and the extra flexibility (and complexity) that build configurations offer is entirely optional.

默认情况下,创建新项目时,开箱即用地创建了一组构建配置。 为每个平台创建一个配置,并且它们都继承自通用的基本构建配置。 这意味着工作流可以像当前在Unity中一样简单,构建配置所提供的额外灵活性(和复杂性)完全是可选的。

If you had access to custom build configurations, what would you use them for that you can’t do today? Or what workflows would become simpler for you?

如果您可以访问自定义构建配置,那么您将用它们做什么呢? 或哪种工作流程对您来说会变得更简单?

翻译自: https://blogs.unity3d.com/2014/10/02/in-the-labs-custom-build-configurations/

自定义构建

相关文章: