预设
Project Settings

Build Settings

在 Build Settings 窗口中可以选择目标平台,调整构建设置,以及启动构建过程。要访问 Build Settings 窗口,请选择 File > Build Settings…。指定构建设置后,可单击 Build 创建构建版本,或单击 Build And Run 在指定的平台上创建并运行构建版本。

Build Settings 窗口
Build Settings 窗口

Scenes in Build

窗口的这一部分显示了项目中将包含在构建中的场景。如果没有显示场景,则可以使用 Add Current 按钮将当前场景添加到构建中,或者可以从 Project 窗口将场景资源拖动到此窗口中。也可以取消选中此列表中的场景以将其从构建中排除,而无需将其从列表中删除。如果构建中不再需要某个场景,则可以通过按 Delete 键将其从场景列表中删除。

勾选并添加到 Scenes in Build 列表中的场景将包含在构建中。场景列表将用于控制场景的加载顺序。可以通过向上或向下拖动来调整场景的顺序。

平台列表

Scenes in Build 区域下方的 Platform 区域列出了您的 Unity 版本可用的所有平台。某些平台可能会显示为灰色,表示它们不属于您的版本,或者用于邀请您下载平台特定的构建选项。选择其中一个平台将控制将构建哪个平台。如果更改目标平台,则需要按“Switch Platform”按钮应用更改。此过程可能需要一些时间进行切换,因为可能需要使用与目标平台匹配的格式重新导入资源。当前选定的平台会在平台名称右侧显示 Unity 图标。

所选平台将显示可针对该构建进行调整的选项列表。每个平台可能有不同的选项。下面列出了这些选项。许多平台共同的选项列在本节最底部的“通用构建选项”详细信息中。

PC, Mac & Linux Standalone

选项 目的
Target Platform
        Windows 以 Windows 为构建目标
        Mac OS X 以 Mac 为构建目标
        Linux 以 Linux 为构建目标
Architecture x86
        x86 32 位 CPU
        x86_64 64 位 CPU
        Universal 所有 CPU 设备
        x86 + x86_64 (Universal) 适用于 Linux 的所有 CPU 设备
Copy PDB files (仅限 Windows)在构建的独立平台播放器中包含 Microsoft 程序数据库 (PDB) 文件。PDB 文件包含对调试有用的应用程序调试信息,但可能会增加播放器的大小。默认情况下会禁用此设置。
Headless Mode 构建游戏以供服务器使用,没有视觉元素

iOS

Option Purpose
Run in Xcode Select the version of Xcode to use in the build. When set to Latest version,the build uses the most recent version of Xcode on your machine.
Run in Xcode as
Release Shipping version
Debug Testing version
Symlink Unity libraries Reference to the Unity libraries instead of copying them into the XCode project. (Reduces the XCode project size.)

Android

选项 目的
Texture Compression Choose from the following texture compression formats:
Don’t override
DXT (Tegra)
PVRTC (PowerVR)
ATC (Adreno)
ETC (default)
ETC2 (GLES 3.0)
ASTC
For advice on using these formats, see Getting started with Android development.
ETC2 fallback For Android devices that don’t support ETC2, override the default ETC2 texture decompression by choosing from 32 or 16 bit format, or 32 bit format with half the resolution.
Build System
        Internal (Default) Generate the output package (APK) using the internal Unity build process, based on Android SDK utilities.
        Gradle (New) Generate the output package (APK) using the Gradle build system. Supports direct Build and Run and exporting the project to a directory. This is the preferred option for exporting a project, as Gradle is the native format for Android Studio.
        ADT (Legacy) Export the project in ADT (eclipse) format. The output package (APK) can be built in eclipse or Android Studio. This project type is no longer supported by Google and is considered obsolete.
SDKs for App Stores Select which third party app stores to integrate with. To include an integration, click Add next to an App Store name. The Unity Package Manager automatically downloads and includes the relevant integration package.

WebGL

WebGL 的 Build Settings 使用本页后面显示的通用设置。

三星电视

三星电视的 Build Settings 使用本页后面显示的通用设置。

Xiaomi

有关为 Xiaomi Game Center 构建项目的信息,请参阅 Unity Xiaomi 文档

其他平台

在《用户指南》的“特定于平台的信息”部分介绍了需要 Unity 许可证的游戏主机平台和设备。

通用构建选项

Option Purpose
Development Build Allow the developer to test and work out how the build is coming along.
Autoconnect Profiler When the Development Build option is selected allow the profiler to connect to the build.
Script Debugging When the Development Build option is selected allow the script code to be debugged. Not available on WebGL.
Scripts Only Build Build just the scripts in the current Project.
Compression Method Compress the data in your Project when building the Player. This includes Assets, Scenes, Player Settings and GI data. Choose between the following methods:
Default On PC, Mac, Linux Standalone, and iOS, there is no compression by default. On Android, the default compression is ZIP, which gives slightly better compression results than LZ4HC, but data is slower to decompress.
LZ4 A fast compression format that is useful for development builds. For more information, see BuildOptions.CompressWithLz4.
LZ4HC A high compression variant of LZ4 that is slower to build but produces better results for release builds. For more information, see BuildOptions.CompressWithLz4HC.

  • • 2017–08–24 页面已修订但未经编辑审查

  • 2017.2 中添加了 Xiaomi 构建目标 NewIn20172

  • 2017.3 中停止了 Tizen 支持 NewIn20173

预设
Project Settings