Version: 2020.3
Linux
Build Settings

Linux Player settings

This page details the Player settings for the Linux platform. For a description of the general Player settings, see Player Settings.

Linux Player settings
Linux Player settings

您可以在以下部分找到这些属性的文档:

Icon

Enable the Override for Windows, Mac, Linux setting to assign a custom icon for your desktop game. You can upload different sizes of the icon to fit each of the squares provided.

Icon settings for the Desktop platforms
Icon settings for the Desktop platforms

Resolution and Presentation

使用 Resolution and Presentation 部分可在 ResolutionStandalone Player Options 部分中自定义屏幕的外观方面。

Resolution 部分

此部分可以自定义屏幕模式和默认大小。

Resolution section for the Desktop platforms
Resolution section for the Desktop platforms
属性 功能
Fullscreen Mode 选择全屏模式。此设置定义了启动时的默认窗口模式。
Fullscreen Window 将应用程序窗口设置为显示器的全屏原始分辨率。Unity 以脚本设置的分辨率(或在构建的应用程序启动时由用户选择)渲染应用程序内容,但是将其缩放以填充窗口。缩放时,Unity 会在渲染输出中添加黑条以匹配 Player 设置中选择的宽高比,这样就不会拉伸内容。这个过程称为边框化 (letterboxing)
Exclusive Fullscreen (Windows only) 设置应用程序以保持对显示器的单独全屏使用。与 Fullscreen Window 不同,此模式会更改显示器的操作系统分辨率来匹配应用程序选择的分辨率。此选项仅在 Windows 上受支持;在其他平台上,设置将回退到 Fullscreen Window
Maximized Window (Mac only) 将应用程序窗口设置为操作系统的“最大化”定义。在 macOS 上,这意味着显示带有自动隐藏菜单栏和停靠栏的全屏窗口。此选项仅在 macOS 上受支持;在其他平台上,设置将回退到 Fullscreen Window
Windowed 将应用程序设置为标准的非全屏可移动窗口,其大小取决于应用程序分辨率。在此模式中,默认情况下可以调整窗口大小。要禁用此功能,请禁用 Resizable Window 设置。
Default Is Native Resolution 启用此选项可使游戏使用目标机器上使用的默认分辨率。如果 Fullscreen Mode 设置为 Windowed_,此选项不可用。| |Default Screen Width ||设置游戏画面的默认宽度(以像素为单位)。仅在 Fullscreen Mode 设置为 Windowed_ 时,此选项才可用。
Default Screen Height 设置游戏画面的默认高度(以像素为单位)。仅在 Fullscreen Mode 设置为 Windowed 时,此选项才可用。
Mac Retina Support 启用此选项可在 Mac 上启用高 DPI (Retina) 屏幕支持。Unity 默认情况下启用此功能。此功能可增强 Retina 显示屏上的项目显示效果,但在激活状态下会有点耗费资源。
Run In background Enable this option to have the game running in the background instead of pausing if the app loses focus.

Standalone Player Options 部分

Use this section to specify the settings to customize the screen. For example, you can set options for users to resize the screen and specify how many instances can run concurrently.

Player Options for the Desktop platforms
Player Options for the Desktop platforms
属性 功能
Capture Single Screen Enable this option to ensure desktop games in Fullscreen Mode do not darken the secondary monitor in multi-monitor setups. This is not supported on Mac OS X.
Use Player Log 启用此选项可向日志文件写入调试信息。默认已启用。
警告:如果计划将应用程序提交到 Mac App Store,请禁用此选项。有关更多信息,请参阅发布到 Mac App Store
Resizable Window Enable this option to allow resizing of the player window.
Note: If you disable this option, your application can’t use the Windowed Fullscreen Mode.
Visible in Background 如果已将 Fullscreen Mode 设置为 _Windowed_,启用此选项可在背景中显示应用程序(在 Windows 中)。
Allow Fullscreen Switch 启用此选项可允许通过默认操作系统全屏按键在全屏模式和窗口模式之间切换。
Force Single Instance Enable this option to restrict desktop players to a single concurrent running instance.
Supported Aspect Ratios 启用希望游戏启动时出现在分辨率对话框中的每个宽高比(只要用户的显示屏支持这些宽高比设置)。

Splash Image

Use the Virtual Reality Splash Image setting to select a custom splash image for Virtual Reality displays. For information on common Splash Screen settings, see Splash Screen.

Splash Image Player settings for Desktop platforms
Splash Image Player settings for Desktop platforms

Other Settings

此部分可以自定义一系列选项,这些选项分为以下几组:

Rendering

Use these settings to customize how Unity renders your game for desktop (Windows, Mac, Linux) platforms.

Rendering Player settings for Desktop platforms
Rendering Player settings for Desktop platforms
属性 功能
Color Space 选择应该用于渲染的颜色空间,选项为:__Gamma__ 或 Linear
请参阅线性渲染概述以了解这两者之间的区别。
Auto Graphics API for Windows 启用此选项可在运行游戏的 Windows 计算机上使用最佳图形 API。禁用此选项可添加和删除支持的图形 API。
Auto Graphics API for Mac 启用此选项可在运行游戏的 Mac 上使用最佳图形 API。禁用此选项可添加和删除支持的图形 API。
Auto Graphics API for Linux 启用此选项可在运行游戏的 Linux 计算机上使用最佳图形 API。禁用此选项可添加和删除支持的图形 API。
Color Gamut for Mac You can add or remove color gamuts for the Mac platform to use for rendering. Click the plus (+) icon to see a list of available gamuts. A color gamut defines a possible range of colors available
Metal API Validation 如果需要调试着色器问题,请启用此选项。
注意:验证会提高 CPU 使用率,因此仅在进行调试时使用。
Metal Write-Only Backbuffer 允许在非默认设备方向上提高性能。此属性会在后缓冲区上设置 frameBufferOnly 标志,因此会阻止从后缓冲区的回读,但可实现一定程度的驱动程序优化。
Memoryless Depth 选择何时使用无记忆渲染纹理。无记忆渲染纹理在渲染时临时存储在区块内存中,而不是存储在 CPU 或 GPU 内存中。这可减少应用的内存使用量,但您无法读取或写入这些渲染纹理。
注意:只有 iOS、tvOS 10.0+ Metal 和 Vulkan 上支持无记忆渲染纹理。在其他平台上,渲染纹理受读/写保护并存储在 CPU 或 GPU 内存中。
Unused 从不使用无记忆帧缓冲区深度。
Forced 始终使用无记忆帧缓冲区深度。
Automatic 让 Unity 决定何时使用无记忆帧缓冲区深度。
Static Batching 启用此选项可使用静态批处理。
Dynamic Batching 启用此选项可在构建中使用动态批处理(默认情况下启用)。
注意:可编程渲染管线激活时,动态批处理无效,所以仅当 Scriptable Render Pipeline Asset Graphics 设置中未设置任何内容时,此设置才可见。
Compute Skinning 启用此选项可使用 DX11/ES3 GPU 计算蒙皮,这样可以释放 CPU 资源。
Graphics Jobs 启用此选项可指示 Unity 将图形任务(渲染循环)卸载到在其他 CPU 核心上运行的工作线程。此功能旨在减少主线程上 Camera.Render 所花费的时间,该时间通常成为瓶颈。
Lightmap Streaming Enabled Whether to use Mipmap Streaming for lightmaps. Unity applies this setting to all lightmaps when it generates them.
Note: To use this setting, you must enable the Texture Streaming Quality setting.
Streaming Priority Set the priority for all lightmaps in the Mipmap Streaming system. Unity applies this setting to all lightmaps when it generates them.
Positive numbers give higher priority. Valid values range from –128 to 127.
Streaming Priority 设置光照贴图 Mipmap 串流优先级以解决资源冲突。这些值应用于生成的光照贴图纹理。
正数提供更高的优先级。有效值范围为 –128 到 127。
Frame Timing Stats 启用此属性可收集 CPU 和 GPU 帧时间统计信息。此属性与动态分辨率摄像机设置同时使用可确定应用程序是受 CPU 还是受 GPU 限制。
Use Display In HDR Mode__(仅限 Windows)||选中此复选框可使游戏在运行时自动切换到 HDR 模式输出。这项设置仅适用于支持该功能的显示屏。如果显示屏不支持 HDR 模式,则游戏将在标准模式下运行。|| |Swap Chain Bit Depth_||选择每个颜色通道中用于交换链缓冲区的位数。仅在启用 HDR 模式的情况下可用。| ||Bit Depth 10|Unity 将使用 R10G10B10A2 缓冲区格式和 Rec2020 原色(采用 ST2084 PQ 编码)。| ||Bit Depth 16_ Unity 将使用 R16G16B16A16 缓冲区格式和 Rec709 原色及线性颜色(无编码)。

Vulkan Settings

Vulkan Player settings for Linux.
Vulkan Player settings for Linux.
属性 功能
SRGB Write Mode Enable this option to allow Graphics.SetSRGBWrite() renderer to toggle the sRGB write mode during runtime. That is, if you want to temporarily turn off Linear-to-sRGB write color conversion, you can use this property to achieve that. Enabling this has a negative impact on performance on mobile tile-based GPUs; therefore, do NOT enable this for mobile.
Number of swapchain buffers Set this option to 2 for double-buffering, or 3 for triple-buffering to use with Vulkan renderer. This setting may help with latency on some platforms, but in most cases you should not change this from the default value of 3. Double-buffering might have a negative impact on performance. Do not use this setting on Android.
Acquire swapchain image late as possible If enabled, Vulkan delays acquiring the backbuffer until after it renders the frame to an offscreen image. Vulkan uses a staging image to achieve this. Enabling this setting causes an extra blit when presenting the backbuffer. This setting, in combination with double-buffering, can improve performance. However, it also can cause performance issues because the additional blit takes up bandwidth.

Mac App Store Options

Mac App Store Options
Mac App Store Options
属性 功能
Override Default Bundle Identifier Indicates whether you can manually set the bundle identifier.
Bundle Identifier Enter the Bundle Identifier of your application. This appears as CFBundleIdentifier in the associated info.plist file. See the Apple developer documentation on CFBundleIdentifier to learn more.
To set this property, enable Override Default Bundle Identifier.
Build Enter the build number for this version of your app. This appears as CFBundleVersion in the associated info.plist file. See the Apple developer documentation on CFBundleVersion to learn more.
类别 Enter the string corresponding to the app’s type. The App Store uses this string to determine the appropriate categorization for the app. By default, this is set to the game category, public.app-category.games. See the Apple developer documentation on LSApplicationCategoryType to see the list of category types available.
Mac App Store Validation 通过启用此属性,可确保只有当应用程序包含来自 Mac App Store 的有效收据时才会运行。这样可以防止用户不在购买游戏的设备上而在另一台设备上运行游戏。仅当您已实施自己的收据验证时,才应禁用此设置。

发布到 Mac App Store

The Use Player Log property enables writing a log file with debugging information. This is useful for investigating problems with your game. However, you must disable this when publishing games for Apple’s Mac App Store to avoid Apple Store rejecting your submission. See the Unity Manual Log Files page for further information about log files.

Use Mac App Store Validation 属性可启用 Mac App Store 的收据验证。如果启用此属性,则只有当游戏包含来自 Mac App Store 的有效收据时才会运行。将游戏提交给 Apple 以便在 App Store 上发布时,应使用此功能。这样可以防止用户不在购买游戏的计算机上而在另一台计算机上运行游戏。

Note that this feature does not implement any strong copy protection. In particular, any potential crack against one Unity game would work against any other Unity content. For this reason, it is recommended that you implement your own receipt validation code on top of this, using Unity’s plugin feature. However, since Apple requires plugin validation to initially happen before showing the screen setup dialog, you should still enable this property to avoid rejections from Apple Store.

配置

Configuration settings for desktop platforms
Configuration settings for desktop platforms
设置 功能
Scripting Backend 选择要使用的脚本后端。脚本后端确定 Unity 如何在项目中编译和执行 C# 代码。
Mono 将 C# 代码编译为 .NET 公共中间语言 (CIL) 并使用公共语言运行时执行该 CIL。有关更多信息,请参阅 Mono Project 网站。
IL2CPP 将 C# 代码编译为 CIL,将 CIL 转换为 C++,然后将该 C++ 编译为本机机器代码,该代码在运行时直接执行。请参阅 IL2CPP 以了解更多信息。
API Compatibility Level Choose which .NET APIs you can use in your project. This setting can affect compatibility with 3rd-party libraries. However, it has no effect on Editor-specific code (code in an Editor directory, or within an Editor-specific Assembly Definition).
Tip: If you are having problems with a third-party assembly, you can try the suggestion in the API Compatibility Level section below.
.Net Standard 兼容 .NET Standard 2.0。生成较小的构建并具有完整的跨平台支持。
.Net Framework 兼容 .NET Framework 4(包括 .NET Standard 2.0 配置文件中的所有内容以及其他 API)。如果使用的库需要访问 .NET Standard 2.0 中未包含的 API,请选择此选项。生成更大的构建,并且任何可用的其他 API 不一定在所有平台上都受支持。有关更多信息,请参阅引用其他类库程序集
C++ Compiler Configuration 选择在编译 IL2CPP 生成的代码时使用的 C++ 编译器配置。
注意:除非 Scripting Backend 设置为 IL2CPP_,否则此属性被禁用。| |Use incremental GC|| Enable this to use the incremental garbage collector, which spreads garbage collection over several frames to reduce gc-related spikes in frame duration.| |Active Input Handling|| 选择您希望如何处理来自用户的输入。 | ||Input Manager (old)| Use the default Input window. | ||Input System (Preview)| 使用较新的输入系统。输入系统作为此版本的预览包提供。要试用输入系统的预览版,请安装 InputSystem 包。| ||Both_
并排使用两个系统。

API Compatibility Level

You can choose your mono API compatibility level for all targets. Sometimes a 3rd-party .NET library uses functionality that is outside of your .NET compatibility level. To understand what’s going on in such cases, and how to best fix it, try following these suggestions:

  1. Install ILSpy for Windows.
  2. Drag the .NET assemblies for the API compatilibity level you are having issues with into ILSpy. You can find these under Frameworks/Mono/lib/mono/YOURSUBSET/. 3.拖入第三方程序集。 4.右键单击第三方程序集并选择 Analyze。 5.在分析报告中,检查 Depends on 部分。此报告以红色突出显示第三方程序集所依赖的但在您选择的 .NET 兼容性级别中不可用的任何内容。

Script Compilation

Script compilation settings for Desktop platforms
Script compilation settings for Desktop platforms
设置 功能
Scripting Define Symbols Set custom compilation flags. For more details, see the documentation on Platform dependent compilation.
Additional Compiler Arguments Add entries to this list to pass additional arguments to the Roslyn compiler. Use one new entry for each additional argument.
To create a new entry, press the ‘+’ button. To remove an entry, press the ‘-’ button.
When you have added all desired arguments, click the Apply button to include your additional arguments in future compilations.The Revert button resets this list to the most recent applied state.
Suppress Common Warnings Disable this setting to display the C# warnings CS0169 and CS0649.
Allow ‘unsafe’ Code Enable support for compiling ‘unsafe’ C# code in a pre-defined assembly (for example, Assembly-CSharp.dll).
For Assembly Definition Files (.asmdef), click on one of your .asmdef files and enable the option in the Inspector window that appears.
Use Deterministic Compilation Disable this setting to prevent compilation with the -deterministic C# flag. With this setting enabled, compiled assemblies are byte-for-byte identical each time they are compiled.
For more information, see Microsoft’s deterministic compiler option documentation.
Enable Roslyn Analyzers Disable this setting to compile user-written scripts without Roslyn analyzer DLLs that might be present in your project.

Optimization

Optimization settings for Desktop platforms
Optimization settings for Desktop platforms
设置 功能
Prebake Collision Meshes Enable this option to add collision data to Meshes at build time.
Keep Loaded Shaders Alive When enabled, you cannot unload a shader. See Shader Loading for more information.
Preloaded Assets Set an array of Assets for the player to load on startup.
To add new Assets, increase the value of the Size property, then set a reference to the Asset to load in the new Element box that appears.
AOT compilation options 提前 (AOT) 编译的附加选项。这有助于优化构建的 iOS 播放器的大小
Strip Engine Code 如果希望 Unity Linker 工具删除您的项目不使用的 Unity 引擎功能的代码,请启用此选项。此设置仅适用于 IL2CPP 脚本后端。

大多数应用程序并不会使用每个可用的 DLL。此选项会剥离您的应用程序不使用的 DLL,从而减小所构建的 Player 的大小。如果您的应用程序使用的一个或多个类通常在当前设置下会被删除,则当您尝试构建该应用程序时,Unity 将显示一条调试消息。
Managed Stripping Level Choose how Unity strips unused managed (C#) code.The options are Disabled Low, Medium, and High.

When Unity builds your app, the Unity Linker process can strip unused code from the managed DLLs your Project uses. Stripping code can make the resulting executable significantly smaller, but can sometimes accidentally remove code that is in use. For more information about these options, see documentation on Managed code stripping.

For information about bytecode stripping with IL2CPP, see documentation on Managed bytecode stripping with IL2CPP.
Script Call Optimization 选择如何在运行时选择性地禁用异常处理以提高速度。有关更多信息,请参阅 iOS 优化
Slow and Safe 使用完整的异常处理(使用 Mono 脚本后端时会对设备的性能有一些影响)。
Fast but no Exceptions No data provided for exceptions on the device (the app runs faster when using the Mono scripting backend).
Note: Using this option with the IL2CPP scripting backend doesn’t impact performance, but it might help avoid undefined behavior on release builds.
Vertex Compression Choose the channel that you want to set for compressing meshes under the vertex compression method, which by default, is set to Mixed. This affects all the meshes in your project. Typically, Vertex Compression is used to reduce the size of mesh data in memory, reduce file size, and improve GPU performance. For information on how to configure vertex compression and limitations of this setting, see [compressing meshes].
Optimize Mesh Data Selecting this option enables stripping of unused vertex attributes from the mesh used in a build.
This reduces the amount of data in the mesh, which might help reduce build size, loading times, and runtime memory usage. However, you must remember to not change material or shader settings at runtime, if you have this setting enabled. See PlayerSettings.stripUnusedMeshComponents for more information.
Texture MipMap Stripping Enable this option to enable mipmap stripping for all platforms, which strips unused mipmaps from Textures at build time. Unity determines unused mipmaps by comparing the value of the mipmap against the Quality Settings for the current platform. If a mipmap value is excluded from every Quality Setting for the current platform, then Unity strips those mipmaps from the build at build time. If QualitySettings.masterTextureLimit is set to a mipmap value that has been stripped, Unity will set the value to the closest mipmap value that has not been stripped.

Logging

独立平台播放器平台的 Logging 设置
独立平台播放器平台的 Logging 设置
  • Select your preferred logging method from the available options.
  • Check a box that corresponds to each Log Type (Error, Assert, Warning, Log, and Exception) based on the type of logging you require. For example:
    • ScriptOnly: Logs only when running scripts.
    • Full: Logs all the time.
    • None: No logs are ever recorded.

Legacy

Legacy settings for Desktop platforms
Legacy settings for Desktop platforms
属性 功能
Clamp BlendShapes (Deprecated) Enable the option to clamp the range of blend shape weights in SkinnedMeshRenderers.
Upload Cleared Texture Data This is a legacy feature and currently not needed because it uses up the bandwidth. By default, this is enabled for debugging purposes. Enabling this setting clears the initial data and automatically uploads the Texture from script to the video memory.
Linux
Build Settings