Version: 2022.1
Building and delivering for Universal Windows Platform
通用 Windows 平台:使用 IL2CPP 脚本后端生成的项目

通用 Windows 平台 (UWP) 构建设置

要为 UWP 创建构建版本,请访问 Build Settings__(菜单:__File > Build Settings__)。在 Platform__ 列表中,选择 Universal Windows Platform__,然后选择 Switch Platform__ 按钮。

注意__:仅当您在 Windows 计算机上使用 Unity 时,才会在 Platform__ 列表中显示 Universal Windows Platform

Unity 不支持 Windows Phone 开发。

使用 Unity 构建 UWP 应用程序

使用 Unity 为 UWP 构建游戏或应用程序时的主要工作流程如下:

When you click Build in the Build Settings window:

1.Unity 将生成并导出 Visual Studio 项目。

2.在 Visual Studio 中打开生成的项目的 .sln 文件。

3.使用 Visual Studio 构建您的最终应用程序。

单击 Build And Run 时,Unity 会构建一个可独立运行的应用程序可执行文件。

UWP 构建设置

请使用以下设置来配置 Unity 构建应用程序的方式。

设置 功能
Architecture Select the CPU to build from the following options (only applies to Build And Run).
x64 64-bit CPU.
x86 32-bit CPU.
ARM 32-bit ARM CPU.
ARM64 64-bit ARM CPU.
Build Type Select the Visual Studio project or build type to generate.
XAML Project Visual Studio project that integrates Unity within a full XAML environment. This results in some performance loss, but lets you use XAML elements in your application.
D3D Project Visual Studio project that integrates Unity in a basic app window. This results in the best performance.
Executable Only Hosts the project in a pre-built executable for rapid iteration. This setting has the quickest iteration speed because it doesn’t require you to build the generated project in Visual Studio. It offers the same performance as D3D Project builds.
Target SDK Version The Windows 10 SDK installed on the local PC to build the application against. This setting is only relevant when calling Windows 10 APIs directly from scripts.

Note: Unity requires the base Windows 10 SDK version 10.0.10240.0 or higher for building UWP apps, and doesn’t support Windows 8/8.1 SDKs.
Minimum Platform Version Minimum Windows 10 release version required to run the app.

Note: This setting is only relevant if you’re using Windows features or APIs that aren’t available in the base Windows 10 version (10.0.10240).
Visual Studio Version Target a specific Visual Studio release if you have multiple versions installed.
Build and Run on Select the target device or transport to deploy and launch the app during Build And Run.
Local Machine Deploys and launches the app on the local PC.
Remote Device (via Device Portal) Deploys and launches the app to a connected device over the Device Portal transport.

To deploy over the Device Portal, you must enter the connection and authentication information in these additional fields:

- Device Portal Address (required)
- Device Portal Username (optional)
- Device Portal Password (optional)

For more information, see documentation on Windows Device Portal deployment.
Build Configuration Select the build type (only applies to Build And Run).
Note: These build configurations are the same as those available in the Visual Studio project that Unity generates.
Debug Produces a build that contains additional code you can use for debugging, and enables the Profiler for your build.
Release Produces a build that has debug code stripped out, and enables the Profiler for your build.
Master Produces a build that’s fully optimized for release.
Copy References Disable this setting to allow the generated solution to reference Unity files from Unity’s installation folder instead of copying them to the build folder. This can save up to 10 GB of disk space, but you can’t copy the build folder to another PC. Unity also builds your application faster when you disable this setting.
Copy PDB files Enable this setting to include Microsoft program database (PDB) files in the built Standalone Player. PDB files contain debugging information for your application, but might increase the size of your Player. For more information, see documentation on Windows debugging.
Development Build A development build includes scripting debug symbols. When you select the Development Build setting, you can also select the Autoconnect Profiler, Script Debugging, and Scripts Only Build setting. It also enables the DEVELOPMENT_BUILD #define.

For more information about #define directives, see documentation on Platform dependent compilation.
Autoconnect Profiler Automatically connect the Profiler to the build. Only available if you enable the Development Build setting. For more information on the Profiler, see Profiler overview.
Deep Profiling When you enable Deep Profiling, Unity profiles all of your script code and records all function calls. This is useful to pinpoint performance issues with your game code. However, it uses a lot of memory and might not work with complex scripts. For more information, see documentation on deep profiling.
Script Debugging Attach script debuggers to the Player remotely. Only available if you enable the Development Build setting.
Scripts Only Build Enable this setting to build just the scripts in the current Project. Only available if you enable the Development Build setting.

Once enabled, Unity only rebuilds the scripts in your application, and leaves data files from a previously executed build intact. It significantly improves iteration times if you only change the code in your application.

Note: You need to build the entire Project once before you can use this setting.
Compression Method Compress the data in your Project at build time. This includes Assets, Scenes, Player settings, and GI data. Choose between the following methods:
Default The Default compression is set to None.
LZ4 This is a fast compression format that’s useful for development builds. LZ4 compression can improve loading time of applications built with Unity. For more information, see BuildOptions.CompressWithLz4.
LZ4HC LZ4HC is a high compression variant of LZ4 that’s slower to build but produces better results for release builds. LZ4HC compression can improve loading time of applications built with Unity. For more information, see BuildOptions.CompressWithLz4HC.
Building and delivering for Universal Windows Platform
通用 Windows 平台:使用 IL2CPP 脚本后端生成的项目