Version: 2021.2
macOS
macOS 播放器:IL2CPP 脚本后端

MacOS Player settings

This page details the Player settings specific to Mac OSX. For a description of the general Player settings, see Player Settings.

MacOS Player settings
MacOS 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 section for the Desktop Player platforms
Resolution section for the Desktop Player 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 settings for Desktop platforms
Player Options settings for Desktop platforms
属性 功能
Capture Single Screen 启用此选项可确保全屏模式 (Fullscreen Mode) 下的独立平台游戏不会使多显示屏设置中的辅助显示屏变暗。Mac OS X 上不支持该功能。
Use Player Log 启用此选项可向日志文件写入调试信息。默认已启用。
警告:如果计划将应用程序提交到 Mac App Store,请禁用此选项。有关更多信息,请参阅发布到 Mac App Store
Resizable Window Enable this option to allow resizing of the desktop 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 platforms.

Rendering Player settings for desktop platforms
Rendering Player settings for desktop platforms
Property Description
Color Space Choose which color space Unity uses for rendering: Gamma or Linear. See the Linear rendering overview for an explanation of the difference between the two.
Gamma: Gamma color space is typically used for calculating lighting on older hardware restricted to 8 bits per channel for the framebuffer format. Even though monitors today are digital, they might still take a gamma-encoded signal as input.
Linear: Linear color space rendering gives more precise results. When you select to work in linear color space, the Editor defaults to using sRGB sampling. If your Textures are in linear color space, you need to work in linear color space and disable sRGB sampling for each Texture.
Auto Graphics API for Windows Enable this option to use the best Graphics API on the Windows machine the game is running on. Disable it to add and remove supported Graphics APIs.
Auto Graphics API for Mac Enable this option to use the best Graphics API on the Mac the game is running on. Disable it to add and remove supported Graphics APIs.
Auto Graphics API for Linux Enable this option to use the best Graphics API on the Linux machine it runs on. Disable it to add and remove supported Graphics APIs.
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 for a given device (such as a monitor or screen). The sRGB gamut is the default (and required) gamut.
Metal API Validation Enable this option when you need to debug Shader issues.
Note: Validation increases CPU usage, so use it only for debugging.
Metal Write-Only Backbuffer Allow improved performance in non-default device orientation. This sets the frameBufferOnly flag on the back buffer, which prevents readback from the back buffer but enables some driver optimization.
Memoryless Depth Choose when to use memoryless render textures. Memoryless render textures are temporarily stored in the on-tile memory when rendered, not in CPU or GPU memory. This reduces memory usage of your app but you cannot read or write to these render textures.
Note: Memoryless render textures are only supported on iOS, tvOS 10.0+ Metal and Vulkan. Render textures are read/write protected and stored in CPU or GPU memory on other platforms.
Unused Never use memoryless framebuffer depth.
Forced Always use memoryless framebuffer depth.
Automatic Let Unity decide when to use memoryless framebuffer depth.
Static Batching Enable this option to use Static batching.
Dynamic Batching Enable this option to use Dynamic Batching on your build (enabled by default).
Note: Dynamic batching has no effect when a Scriptable Render Pipeline is active, so this setting is only visible when nothing is set in the Scriptable Render Pipeline Asset Graphics setting.
Compute Skinning Enable this option to enable DX11/ES3 GPU compute skinning, freeing up CPU resources.
Graphics Jobs Enable this option to instruct Unity to offload graphics tasks (render loops) to worker threads running on other CPU cores. This is intended to reduce the time spent in Camera.Render on the main thread, which is often a bottleneck.
Lightmap Encoding Choose Normal Quality or High Quality to set the lightmap encoding. This setting affects the encoding scheme and compression format of the lightmaps.
Lightmap Streaming Enable this option to load only the lightmap mip maps as needed to render the current game Cameras. This value applies to the lightmap textures as they are generated.
Note: To use this setting, you must enable the Texture Streaming Quality setting.
  Streaming Priority Set the lightmap mip map streaming priority to resolve resource conflicts. These values are applied to the light map textures as they are generated.
Positive numbers give higher priority. Valid values range from –128 to 127.
Frame Timing Stats Enable this property to gather CPU and GPU frame time statistics. Use this together with the Dynamic Resolution camera setting to determine if your application is CPU or GPU bound.
Use Display In HDR Mode (Windows Only) Enable this checkbox to make the game automatically switch to HDR mode output when it runs. This only works on displays that support this feature. If the display does not support HDR mode, the game runs in standard mode.
  Swap Chain Bit Depth Select the number of bits in each color channel for swap chain buffers. Only available if HDR Mode is enabled.
Bit Depth 10 Unity will use the R10G10B10A2 buffer format and Rec2020 primaries with ST2084 PQ encoding.
Bit Depth 16 Unity will use the R16G16B16A16 buffer format and Rec709 primaries with linear color (no encoding).
Virtual Texturing Indicates whether to enable Virtual Texturing.
Note: The Unity Editor requires a restart for this setting to take effect.
Shader precision model Controls the default precision of samplers used in shaders. See Shader data types and precision for more details.
360 Stereo Capture Indicates whether Unity can capture stereoscopic 360 images and videos. When enabled, Unity compiles additional shader variants to support 360 capture (currently only on Windows/OSX). When enabled, enable_360_capture keyword is added during the Stereo RenderCubemap call. Note that this keyword is not triggered outside the Stereo RenderCubemap function. For more information, see Stereo 360 Image and Video Capture.

Vulkan Settings

Vulkan Player settings for macOS.
Vulkan Player settings for macOS.
Property Description
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.
Recycle command buffers Indicates whether to recycle or free CommandBuffers after Unity executes them.

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 的有效收据时才会运行。这样可以防止用户不在购买游戏的设备上而在另一台设备上运行游戏。仅当您已实施自己的收据验证时,才应禁用此设置。

Publishing to the Mac App Store

Use Player Log 属性允许将调试信息写入日志文件。这对于调查游戏问题很有用。但是,在为 Apple 的 Mac App Store 发布游戏时,需要禁用此功能,因为如果启用此功能,Apple 可能会拒绝您提交。有关日志文件的更多信息,请参阅 Unity 手册日志文件页面。

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

请注意,此功能不实现任何强大的复制保护。特别需要说明的是,针对一个 Unity 游戏的任何潜在破解都将对所有其他 Unity 内容有效。因此,建议使用 Unity 的插件功能在此基础上实现您自己的收据验证代码。但是,由于 Apple 要求在显示屏幕设置对话框之前的最初阶段进行插件验证,因此您仍应启用此属性,以免 Apple 拒绝您的提交。

配置

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 选择可以在项目中使用的 .NET API 运行时。此设置可能会影响与第三方库的兼容性。
提示:如果您遇到第三方程序集的问题,可以尝试下文的 API Compatibility Level 部分中的建议。
.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

可为所有目标选择 mono API 兼容性级别。有时,第三方 .NET 库会使用 .NET 兼容性级别之外的功能。为了解在这种情况下可能发生的问题以及如何以最佳方案修复问题,请尝试以下解决方案:

  1. 安装适用于 Windows 的 Reflector
  2. 将出现问题的相关 API 兼容性级别的 .NET 程序集拖到 Reflector 中。可以在 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 允许在预定义的程序集(例如,Assembly-CSharp.dll)中编译“不安全”的 C# 代码
对于程序集定义文件 (.asmdef),请单击其中一个 .asmdef 文件,并在出现的 Inspector 窗口中启用该选项。
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
Property Description
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 Additional options for Ahead of Time (AOT) compilation. This helps optimize the size of the built iOS player.
Strip Engine Code Enable this option if you want the Unity Linker tool to remove code for Unity Engine features that your Project doesn’t use. This setting is only available with the IL2CPP scripting backend.

Most apps don’t use every available DLL. This option strips out DLLs that your app doesn’t use to reduce the size of the built Player. If your app is using one or more classes that would normally be stripped out under your current settings, Unity displays a debug message when you try to build the app.
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.
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.
macOS
macOS 播放器:IL2CPP 脚本后端