Version: 2021.2
Shortcuts Manager
Project Settings

Build Settings

Unity can build your application for different platforms and with different settings. This documentation describes how to define the scenes, target platform, and settings for your build.

To select your platform and settings, and start the build process, use the Build Settings window. To access the Build Settings window: from Unity’s main menu, go to File > Build Settings.

Understanding builds

Unity produces two build types:

  • A release build, which includes only what’s necessary to run the application. This is the default build type.
  • A development build, which includes scripting debug symbols and the Profiler. Selecting the development build option enables an additional set of options, such as deep profiling support and script debugging. These options are explained in the Generic Platform Settings section.

For faster iteration during development, Unity uses an incremental build pipeline that rebuilds artifacts only if they have changed since the previous build. Artifacts include the output of build steps like asset serialization, code compilation, data compression and signing. This is the default for all builds, both release and development.

The incremental build pipeline automates the Scripts Only Build feature. The Scripts Only Build option is therefore only available in the Build Settings window for the platforms that do not use incremental builds.

Note: The incremental build pipeline is currently available only for the Standalone (Windows, Mac and Linux) Android, and WebGL platforms.

Forcing non-incremental builds

You can force a clean (non-incremental) build if you need to. For example, the following circumstances might require a clean build:

  • The build cannot know how a user callback impacts an asset, so it cannot determine when to rebuild an asset manipulated by a callback. In a development build, if you change a callback or its input data and you want Unity to rebuild the asset it impacts, force a clean build.
    As an example, you might need to force a clean build when you use the callbacks IPreprocessShaders.OnProcessShader, PostProcessSceneAttribute and IPreprocessComputeShaders.OnProcessComputeShader, if you expect the result of these callbacks to have changed since the previous build, and you need the build to reflect those changes.
    You do not need to force a clean build for:

    • Callback changes in a release build, because Unity always rebuilds all assets for a release build.
    • If you made any changes to assets the player uses other than user callbacks in a development build, because Unity then rebuilds all assets.
  • If changes are not present after an incremental build, and you suspect there is a problem with the incremental build pipeline, force a clean build.

Managing scenes in a build

When you build your application, Unity builds all selected scenes in the Scenes In Build pane. Unity builds scenes in the order in which they appear in the list.

You can add, exclude, remove and reorder scenes in the list:

  • To add all currently open scenes to the list: Select Add Open Scenes. You can also drag scenes from your Project window into the list.
  • To exclude a scene in the list from the build: Clear the checkbox next to that scene. This removes the scene from the build, but not from the list.
  • To remove a scene from the list: Select the scene and press Delete.
  • To adjust the scene order: Drag and drop scenes in the list to reorder them.
Window, Mac and Linux build settings
Window, Mac and Linux build settings

Platform 列表

Each build must have a target platform. The Platform pane lists all the platforms you can build for.

Each version of Unity installed on your computer has its own platform list.

If the platform you need is not on the list, do one of the following:

  • In the Build Settings window:

    1. Select the platform you want to add.
    2. Select Install or Download.
  • In Unity Hub > Installs:

    1. Select the three dots on the version of Unity you’re using.
    2. Select Add Modules.
    3. Follow the instructions to install the platform module.

To change the build’s target platform:

  1. Select the platform you want to switch to.
    Tip: The list displays the Unity icon next to the platform currently selected as the target platform.
  2. Select Switch Platforms.
    If Unity needs to re-import your assets in formats that match your target platform, the switch process can take a long time.

Build settings

When you select a platform, Unity displays a list of options that you can adjust for the build. Some settings apply to all platforms, and some are platform-specific.

Generic platform settings


设置: 功能:
Development Build Include scripting debug symbols and the Profiler in your build. You should use this setting when you want to test your application.
When you select this option, Unity sets the DEVELOPMENT_BUILD scripting define. Your build then includes preprocessor directives that set DEVELOPMENT_BUILD as a condition (see Platform-dependent compilations).
Autoconnect Profiler Automatically connect the Unity Profiler to your build.

This option is only available if you selected Development Build.
Deep Profiling Support Turn on Deep Profiling in the Profiler. This makes the Profiler instrument every function call in your application so it returns more detailed profiling data. This option might slow down script execution.

This option is only available if you selected Development Build.
Script Debugging Allow your script code to be debugged.

This option is only available if you selected Development Build.
This option is not available for WebGL.
Wait for Managed Debugger Make the Player wait for a debugger to be attached before it executes any script code.

This option is only available if you selected Script Debugging.
IL2CPP Code Generation Define how Unity manages IL2CPP code generation.
This option is only available if you are using IL2CPP for your scripting backend, not Mono.
To change your scripting backend, go to Player Settings > Configuration > Scripting Backend and change from Mono to IL2CPP.
Faster runtime Generates code that is optimized for runtime performance. This is the default, and the behavior in previous versions of Unity.
Faster (smaller) builds Generates code that is optimized for build size and iteration. It generates less code and produces a smaller build, but may have an impact on runtime performance, especially for generic code. You might want to use this option when faster build times are important, such as when iterating on changes.
Compression Method Compress the data in your Project when you build the Player. This includes Assets, Scenes, Player settings, and GI data.

This option is not available for the Lumin and WebGL platforms.
Default On PC, Mac, Linux Standalone, and iOS, there is no default compression.

On Android, the default compression is ZIP, which gives slightly better compression results than LZ4HC. However, ZIP 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.

Asset Import Overrides

To speed up import and platform switch time, you can locally override all texture import settings. Usually you would not ship your final build with any import overrides, but during development they can be useful to speed up iteration time, especially if you are not concerned with assets (textures, in this case) looking as good as possible.

To set asset import overrides for initial project imports, use the editor command line arguments -overrideMaxTextureSize and -overrideTextureCompression.

The default value for both override options is No Override.

设置: 功能:
Max Texture Size Override the maximum imported texture size. Unity imports textures in the lower of two values: this value, or the Max Size value specified in Texture import settings.

The time it takes to import a texture is roughly proportional to the number of pixels it contains, so a lower maximum allowed texture size can speed up import times. However, the resulting textures are lower resolution, so use this setting only during development.
Texture Compression Override the texture compression options set in Texture import settings.

Only affects textures imported into one of the compressed texture formats.
Force Fast Compressor Use a faster but lower quality texture compression mode for formats that support it (BC7, BC6H, ASTC, ETC, ETC2). Usually this results in more compression artifacts, but for many formats the compression itself is 2 to 20 times faster.

This setting also disables Crunch texture compression format on any textures that have it.

The effect of this setting is the same as if all textures had their Compressor Quality set to Fast setting in their platform’s Texture import settings.
Force Uncompressed Do not compress the textures; use uncompressed formats instead. This is faster to import (because it skips the texture compression process), but the resulting textures take up more memory and game data size, and can impact rendering performance.

The effect of this setting is the same as if all textures had their Compression set to None in their platforms’ Texture import settings.

Platform-specific settings

Each platform also has specific build settings:

Building your application

To build your application, select one of the following:

  • Build: Compile a Player, then do nothing. The default build is incremental, except for the first build, which is always a full non-incremental (clean) build. To force a clean build instead of an incremental build, select Clean Build from the dropdown menu.
  • Build and run: Compile a Player and open it on your target platform (for more information, see the individual platform pages). This option always uses the incremental build.
Shortcuts Manager
Project Settings