Version: 2022.1
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 Set your app window to the full-screen native display resolution, covering the whole screen. This mode is also known as borderless full-screen. Unity renders the app content at the resolution set by a script, or the native display resolution if none is set and scales it to fill the window. When scaling, Unity adds black bars to the rendered output to match the display aspect ratio to prevent content stretching. This process is called letterboxing. The OS overlay UI displays on top of the full-screen window (such as IME input windows). All platforms support this mode.
Exclusive Fullscreen (Windows only) Set your app to maintain sole full-screen use of a display. Unlike Fullscreen Window, this mode changes the OS resolution of the display to match the app’s chosen resolution. This option is only supported on Windows.
Maximized Window (Mac only) Set the app window to the operating system’s definition of maximized, which is typically a full-screen window with a hidden menu bar and dock on macOS. This option is only supported on macOS. Fullscreen Window is the default setting for other platforms.
Windowed Set your app to a standard, non-full-screen movable window, the size of which is dependent on the app resolution. In this mode, the window is resizable by default. Use the Resizable Window setting to disable this. All desktop platforms support this full-screen mode.
Default Is Native Resolution Enable this option to make the game use the default resolution used on the target machine. This option isn’t available if the Fullscreen Mode is set to Windowed.
Default Screen Width 设置游戏画面的默认宽度(以像素为单位)。仅在 Fullscreen Mode 设置为 Windowed 时,此选项才可用。
Default Screen Height 设置游戏画面的默认高度(以像素为单位)。仅在 Fullscreen Mode 设置为 Windowed 时,此选项才可用。
Mac Retina Support Enable this option to enable support for high DPI (Retina) screens on a Mac. Unity enables this by default. This enhances Projects on a Retina display, but it’s somewhat resource-intensive when active.
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
设置 功能
Color Space 选择应该用于渲染的颜色空间,选项为:_Gamma_ 或 Linear
请参阅线性渲染概述以了解这两者之间的区别。
Auto Graphics API 启用此选项可在运行游戏的 Mac 上使用最佳图形 API。禁用此选项可添加和删除支持的图形 API。
Color Gamut 可以为 iOS 平台添加或删除色域以用于渲染。单击加号 (+) 图标查看可用色域的列表。色域定义了给定设备(如监视器或屏幕)可以使用的所有颜色范围。sRGB 色域是默认色域(也是必需色域)。
如果目标设备是具备宽色域显示屏的新款 tvOS 设备,请使用 DisplayP3 充分利用显示能力。对于旧设备,使用 Metal Editor Support 作为后备选项。
Multithreaded Rendering 启用此选项可使用多线程渲染。仅 Metal 支持此功能。
Static Batching 启用此选项可使用静态批处理。
Dynamic Batching 选中此复选框可在构建中使用动态批处理(默认情况下启用)。
Compute Skinning 启用此选项可使用 DX11/ES3 GPU 计算蒙皮,这样可以释放 CPU 资源。
Graphics Jobs (Experimental) 启用此选项可指示 Unity 将图形任务(渲染循环)卸载到在其他 CPU 核心上运行的工作线程。此功能旨在减少主线程上 Camera.Render 所花费的时间,该时间通常成为瓶颈。
注意:此功能是实验性的。此功能可能无法为项目带来性能提升,并可能引入新的崩溃。
Texture compression format Choose between ASTC, ETC2 and ETC (ETC1 for RGB, ETC2 for RGBA). See texture compression format overview for more information on how to pick the right format.
See Texture compression settings for more details on how this interacts with the texture compression setting in the Build Settings.
Normal Map Encoding 选择 XYZDXT5nm 样式_对法线贴图编码进行设置。此设置影响用于法线贴图的编码方案和压缩格式。DXT5nm 样式_的法线贴图质量更高,但在着色器中解码成本更高。
Lightmap Encoding 选择 Low QualityNormal QualityHigh Quality 来设置光照贴图编码。此设置影响光照贴图的编码方案和压缩格式。
HDR Cubemap Encoding Choose Low Quality, Normal Quality, or High Quality to set the HDR Cubemap encoding. This setting affects the encoding scheme and compression format of the HDR Cubemaps.
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.
Enable Frame Timing Stats 启用此选项可收集 CPU/GPU 帧时序统计信息。
Swap Chain Bit Depth 选择每个颜色通道中用于交换链缓冲区的位数。仅在启用 HDR 模式的情况下可用。
Bit Depth 10 Unity 将使用 R10G10B10A2 缓冲区格式和 Rec2020 原色(采用 ST2084 PQ 编码)。
Bit Depth 16 Unity 将使用 R16G16B16A16 缓冲区格式和 Rec709 原色及线性颜色(无编码)。
Virtual Texturing Indicates whether to enable Virtual Texturing.
Note: Virtual Texturing isn’t compatible with Android.
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.
Note: This setting affects macOS, iOS, tvOS, and Android.
Bundle Identifier Enter the Bundle Identifier of your application. This appears as CFBundleIdentifier in the associated info.plist file. The Bundle Identifier must follow the convention com.YourCompanyName.YourProductName and must contain only alphanumeric and hyphen characters. For more information, see CFBundleIdentifier.
Important: Unity automatically replaces any invalid characters you type with a hyphen.

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
Property Description
Scripting Backend Choose the scripting backend you want to use. The scripting backend determines how Unity compiles and executes C# code in your Project.
Mono Compiles C# code into .NET Common Intermediate Language (CIL) and executes that CIL using a Common Language Runtime. For more information, see Mono.
IL2CPP Compiles C# code into CIL, converts the CIL to C++ and then compiles that C++ into native machine code, which executes directly at run time. See IL2CPP for more information.
API Compatibility Level Choose which .NET APIs you can use in your project. This setting can affect compatibility with third-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 Compatible with .NET Standard 2.0. Produces smaller builds and has full cross-platform support.
.Net Framework Compatible with the .NET Framework 4 (which includes everything in the .NET Standard 2.0 profile as well as additional APIs). Choose this option when usng libraries that access APIs not included in .NET Standard 2.0. Produces larger builds and any additional APIs available are not necessarily supported on all platforms. See Referencing additional class library assemblies for more information.
IL2CPP Code Generation Defines how Unity manages IL2CPP code generation. This option is only available if you use the IL2CPP scripting backend.
Faster runtime Generates code optimized for runtime performance. This setting is enabled by default.
Faster (smaller) builds) Generates code optimized for build size and iteration. This setting generates less code and produces a smaller build, but may reduce runtime performance, especially for generic code. Use this option when faster build times are important, such as when iterating on changes.
C++ Compiler Configuration Choose the C++ compiler configuration used when compiling IL2CPP generated code.
Note: This property is disabled unless Scripting Backend is set to IL2CPP.
Use incremental GC Uses the incremental garbage collector, which spreads garbage collection over several frames to reduce garbage collection-related spikes in frame duration. For more information, see Automatic Memory Management.
Allow downloads over HTTP Indicates whether to allow downloading content over HTTP. The options are Not allowed, Allowed in Development builds only, and Always allowed. The default option is Not allowed due to the recommended protocol being HTTPS, which is more secure.
Active Input Handling Chooses how to handle input from users.
Input Manager (old) Use the default Input window.
Input System (Preview) Use the newer Input system. The Input System is provided as a preview package for this release. To try a preview of the Input System, install the InputSystem package.
Both Use both systems side by side.

API Compatibility Level

You can choose your mono API compatibility level for all targets. Sometimes a 3rd-party .NET library uses functionality that’s 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 that 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 Sets custom compilation flags.

For more details, see Platform dependent compilation.
Additional Compiler Arguments Adds 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, click Add (+). To remove an entry, click Remove (-).

When you have added all desired arguments, click Apply to include your additional arguments in future compilations. Click Revert to reset this list to the most recent applied state.
Suppress Common Warnings Indicates whether to display the C# warnings CS0169 and CS0649.
Allow ‘unsafe’ Code Enables 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 Indicates whether 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.
Enable Roslyn Analyzers Indicates whether 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 Adds collision data to Meshes at build time.
Keep Loaded Shaders Alive Indicates whether to prevent shaders from being unloaded.

For more information, see Shader Loading.
Preloaded Assets Sets an array of Assets for the player to load on startup.
To add new Assets, increase the value of the Size property and 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 Chooses how aggressively Unity strips unused managed (C#) code. The options are Minimal, 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’s in use.

For more information about these options and bytecode stripping with IL2CPP, see ManagedStrippingLevel.
Vertex Compression Sets vertex compression per channel. 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 more information on how to configure vertex compression and limitations of this setting, see Compressing mesh data.
Optimize Mesh Data Enable this option to strip unused vertex attributes from the mesh used in a build. This option reduces the amount of data in the mesh, which can help reduce build size, loading times, and runtime memory usage.

Warning: If you have this setting enabled, you should remember to not change material or shader settings at runtime.

See PlayerSettings.stripUnusedMeshComponents for more information.
Texture MipMap Stripping Enables mipmap stripping for all platforms. This 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 stack trace method by enabling the option 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.

See stack trace logging for more information.

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 脚本后端