本页面将详细介绍 iOS 特有的 Player 设置。如需了解适用于所有平台的常规 Player 设置的描述,请参阅 Player - 常规设置。
您可以在以下部分找到这些属性的文档:
使用 Icon 设置可自定义您的应用程序在 Apple 商店中的品牌标记。
可为每个 iOS 设备(iPhone、iPad)上传并分配以下类型的自定义图标:
Icon type | Where it displays |
---|---|
Application icons | Main icons for your app |
Spotlight icons | Spotlight search results for your app |
Settings icons | Device’s main Settings page |
Notification icons | Notifications sent from your app |
Marketing icons | App Store |
上传的所有图标都是 2D 纹理类型的资源。如果缺少图标纹理,Unity 将以最接近的大小来缩放图标纹理,并优先使用较大的纹理。
使用 Resolution and Presentation 部分可以自定义屏幕外观的各个方面。
这些设置分为以下几个类别:
使用 Resolution Scaling Mode 设置可以将缩放设置为等于或低于屏幕原始分辨率:
Setting | Function |
---|---|
Disabled | Scaling doesn’t apply and the application renders to its native screen resolution. |
FixedDPI | When you select this value, the Target DPI property appears. Use the Target DPI property to set the target DPI of the game screen. Unity downscales the game screen to match this setting if the device’s native screen DPI is higher than this value. This helps you optimize performance and battery life. You can also use it to target a specific DPI setting. Unity calculates the scale as min(Target DPI * Factor / Screen DPI, 1) . The Factor uses the Resolution Scaling Fixed DPI Factor value you enter in the Quality settings. |
Reset resolution on window resize | Indicates whether to set the screen resolution to the new native window size when the native window size changes. If you set Resolution Scaling Mode to Fixed DPI, Unity recalculates the resolution based on Fixed DPI property. |
从 Default Orientation 下拉菜单中选择游戏的屏幕方向。默认设置是 Auto Rotation。如果选择此设置,则屏幕将按照设备方向旋转。
选择其他设置可以确定主屏幕按钮在屏幕上出现的固定位置:
设置 | 主屏幕按钮位置 |
---|---|
Portrait | 底部 |
Portrait Upside Down | 顶部 |
Landscape Left | 右侧 |
Landscape Right | 左侧 |
Auto Rotation | 屏幕方向随设备方向而变化。此为默认值。 |
注意:Default Orientation 设置对 iOS 和 Android 设备均适用。
在 Default Orientation 中选择 Auto Rotation 时,将出现以下设置:
设置 | 功能 |
---|---|
Use Animated Autorotation | 如果启用此复选框,则当用户旋转设备时,屏幕旋转将使用动画过渡。否则,屏幕旋转会立即改变。 |
Allowed Orientations for Auto Rotation | Auto Rotation 会更改屏幕方向以匹配设备方向。您可能希望限制允许的屏幕方向(例如,将设备锁定为横向)。通过选中本部分中的复选框,启用要允许的每个方向。 |
如果应用程序需要在全屏模式下运行,请启用 Requires Fullscreen 选项。
使用 Status Bar 部分来指定与 iOS 状态栏相关的参数。
Setting | Function |
---|---|
Status Bar Hidden | Enable this option to hide the status bar when your application launches. |
Status Bar Style | Define the style of the status bar when the application launches. The options are Default and Light. |
Disable Depth and Stencil | Enable this option to disable the depth and stencil buffers. |
Render Over Native UI | Enable this option to force your app to render on top of the native iOS UI. |
Show Loading Indicator | Select how the loading indicator appears. The options are White Large, White, and Gray. |
使用 Splash Image 部分可为 iOS 支持的不同设备自定义应用程序的启动画面。
Virtual Reality Splash Image 设置(位于通用 Splash Screen 设置 上方)允许您为虚拟现实显示选择自定义的启动画面。
对于 iPhone 或 iPad,如果选择 Launch screen type 下拉菜单中的 Custom Storyboard 选项,会出现 Custom Storyboard 按钮。
Click the Custom Storyboard button to select a storyboard to display when your game starts up on the device. For your storyboard to appear here, you must first create the storyboard in Xcode and copy it to your Project. For more information, see Apple developer documentation about storyboards, scenes, and connections.
禁用 Use Storyboard for Launch Screen 复选框时,可以采用下列方法之一来实现启动画面:
如果不使用自定义故事板,可以使用 Unity 的内置启动画面来实现启动画面。
启动画面是一个故事板文件,iOS 通过该文件动态地在设备上创建启动画面。具有以下局限性:
这些限制也适用于自定义故事板。
Select the Launch screen type for iPhone and iPad in the iPhone Launch Screen and iPad Launch Screen sections:
值 | 功能 | |
---|---|---|
Default | When you select this option, Unity adds a solid blue-black image that’s the same color as the background for Unity’s default splash screen. The image is used for both portrait and landscape orientations, and displays using aspect-fill mode. | |
None | Apple no longer supports Launch Images. This option exists for backwards compatibility reasons. If you select it, your project will use Unity’s default splash screen instead. | |
Image and background (relative size) | Displays an image in the center of the screen and fills the remaining area with a solid color. | |
Portrait Image | Select an image for portrait orientation. | |
Landscape Image | Select an image for landscape orientation. | |
Background Color | Select a background color to fill any screen space that the image doesn’t cover. | |
Fill percentage | Specify image size as a percentage of the screen size. Unity calculates image size based on the length or width of the screen, whichever one is smaller (vertical for landscape displays, horizontal for portrait ones). | |
Image and background (constant size) | Displays an image in the center of the screen and fills the area with a solid color. This has the same options as Image and background (relative size), except that you specify image size in points rather than as a percentage. Tip: Points and pixels aren’t the same. A pixel (px) is a single dot in your image. A point (pt) is a unit of length that measures 1/72th of an inch. Pixel sizes are relative to the screen size and resolution, while point sizes are the size on any screen. For more information, see W3C guidance on size units. |
|
Custom XIB | When you select this option, the Custom XIB button appears. Click the button to select a custom XIB file to use as a loading screen. | |
Custom Storyboard | When you select this option, the Custom Storyboard button appears. Click the button to select a custom Storyboard file to use as a loading screen. |
注意:如果使用的是 Unity Personal 订阅,Unity 启动画面将在引擎初始化后立即显示,此外还会显示您选择的启动画面。
使用 Debugging and crash reporting 设置可以收集有关应用程序性能的数据并解决崩溃问题。
Setting | Function |
---|---|
Enable Internal Profiler (Deprecated) | This feature is deprecated and will be retired in a future version of Unity. Use the Profiler window instead (menu: Window > Analytics > Profiler). The Profiler collects application performance data and prints a report to the console. The report contains the number of milliseconds each Unity subsystem takes to execute on each frame, averaged across 30 frames. |
On .Net UnhandledException | Select the action Unity takes when a .NET unhandled exception occurs. The options are Crash (the app crashes and generates a crash report, which users can submit to iTunes and developers can use to troubleshoot the crash), or Silent Exit (the application exits with no errors and doesn’t generate a crash report). |
Log Obj-C Uncaught Exceptions | When you enable this action, Unity prints Objective-C Uncaught Exception information to the console. |
Enable Crash Report API | Enables a custom crash reporter to capture crashes. You can use scripts to access crash logs via the CrashReport API. |
可在 Other Settings 部分中配置一系列 Player 设置。这些选项分为以下几组:
使用这些设置可自定义 Unity 针对 iOS 平台渲染应用程序的方式。
Setting | Function | |
---|---|---|
Color Space | Choose which color space Unity uses for rendering: Gamma or Linear. For more information, see Linear rendering overview. Gamma: Gamma color space is typically used for calculating lighting on older hardware restricted to 8 bits per channel for the frame buffer 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. |
|
Color Gamut | You can add or remove color gamuts for the iOS 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. When targeting recent tvOS devices with wide color gamut displays, use DisplayP3 to use the full display capabilities. Use Metal Editor Support as a fallback for older devices. |
|
Multithreaded Rendering | Enable this option to move graphics API calls from Unity’s main thread to a separate worker thread. This can help to improve performance in applications that have high CPU usage on the main thread. | |
Static Batching | Use Static batching. For more information, refer to Draw call batching. | |
Dynamic Batching | Use dynamic batching (enabled by default). For more information, refer to Draw call batching. Note: Dynamic batching has no effect when a Scriptable Render Pipeline is active, so this setting is only visible if the Scriptable Render Pipeline Asset Graphics setting is blank. |
|
Sprite Batching Threshold | Controls the maximum vertex threshold used when batching. | |
Compute Skinning | Enable this option to use Metal GPU compute skinning, which frees up CPU resources. To learn more about GPU compute skinning, see the Wikipedia page on skeletal animation. | |
Graphics Jobs (Experimental) | Enable this option to instruct Unity to offload graphics tasks (render loops) to worker threads running on other CPU cores. This reduces the time spent in Camera.Render on the main thread, which is often a bottleneck. Note: This feature is experimental. It might not deliver a performance improvement for your Project, and might introduce instability. |
|
Texture compression format | Choose between ASTC and PVRTC as the default texture compression format for iOS. Check the texture compression format overview for more information. | |
Normal Map Encoding | Choose XYZ or DXT5nm-style to set the normal map encoding. This affects the encoding scheme and compression format used for normal maps. DXT5nm-style normal maps are of higher quality, but more expensive to decode in shaders. | |
Lightmap Encoding | Defines the encoding scheme and compression format of the lightmaps. You can choose from Low Quality, Normal Quality, or High Quality. |
|
HDR Cubemap Encoding | Defines the encoding scheme and compression format of the HDR Cubemaps. You can choose from Low Quality, Normal Quality, or High Quality. |
|
Lightmap Streaming | Uses 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 | Sets 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. |
|
Frame Timing Stats | Allows Unity to gather CPU/GPU frame timing statistics. Use this option with the Dynamic Resolution camera setting to determine if your application is CPU or GPU bound. | |
Virtual Texturing | Currently not supported on iOS. | |
Shader precision model | Controls the default precision of samplers used in shaders. For more information, see Shader data types and precision. | |
360 Stereo Capture | Currently not supported on iOS. | |
Load/Store Action Debug Mode | Highlights undefined pixels that might cause rendering problems in your built application. The highlighting appears only in the Game view, and your built application if you select Development Build in Build Settings. See LoadStoreActionDebugModeSettings. | |
Editor Only | Highlights undefined pixels in the Game view, but not in your built application. |
输入应用程序的标识信息。
设置 | 功能 |
---|---|
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 provisioning profile of the application you are building. The basic structure of the identifier is com.CompanyName.ProductName. This structure might vary based on which country you live in, so always default to the string Apple provides to you for your Developer Account. Your ProductName is set up in your provisioning certificates. 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. |
Version | 输入捆绑包的 release-version-number 字符串(例如,4.3.6)。 此值在关联的 info.plist 文件中显示为 CFBundleShortVersionString 。有关更多信息,请参阅 Apple 开发者文档的 CFBundleShortVersionString 部分。 |
Build | 输入此应用程序版本的构建版本号。 此值在关联的 info.plist 文件中显示为 CFBundleVersion 。有关更多信息,请参阅 Apple 开发者文档的 CFBundleVersion 部分。 |
Signing Team ID | 输入您的 Apple Developer Team ID。您可以在 Apple 开发者网站上的 Xcode Help 下找到此信息。这将为生成的 Xcode 项目设置 Team ID,从而允许开发者使用 Build and Run 功能。必须输入 Apple Developer Team ID 才能为应用程序自动签名。 有关更多信息,请参阅 Apple 开发者文档的创建团队资源调配配置文件 (Creating Your Team Provisioning Profile) 部分。 |
Automatically Sign | 启用此选项可指示 Xcode 自动为您的构建版本签名。 |
Setting | Function | |
---|---|---|
Scripting Backend | The scripting backend determines how Unity compiles and executes C# code in your Project. This setting defaults to IL2CPP for iOS and can’t be changed. 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. For more information, see documentation on IL2CPP. C++ code generated by the IL2CPP scripting backend can be updated incrementally, which allows incremental C++ build systems to compile only the changed source files. This can significantly lower iteration times. |
|
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). | |
.Net Standard 2.0 | Compatible with .NET Standard 2.0. Produces smaller builds and has full cross-platform support. | |
.Net 4.x | 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 using 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. | |
C++ Compiler Configuration | The C++ compiler configuration used when compiling IL2CPP generated code. This setting defaults to Release for iOS and can’t be changed. | |
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, refer to Automatic Memory Management. |
You can choose your mono API compatibility level for all targets. Sometimes a third-party .NET library uses functionality that is outside of your .NET compatibility level. If you’re on Windows, you can use the third-party software ILSpy to understand what’s happening and how to fix it. Follow these steps:
Setting | Function | |
---|---|---|
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. | |
Camera Usage Description | Enter the reason for accessing the camera on the device. | |
Microphone Usage Description | Enter the reason for accessing the microphone on the device. | |
Location Usage Description | Enter the reason for accessing the location of the device. | |
Use On-Demand Resources | Enable this option to use on-demand resources. When enabled, the Variant map for app slicing section appears. |
|
Accelerometer Frequency | Define how often to sample the accelerometer. You can set the frequency at 15Hz, 30Hz, 60Hz, or 100Hz. Use a lower frequency for better performance. If your app doesn’t use the accelerometer, select Disabled. | |
Mute Other Audio Sources | Enable this option if you want your Unity application to stop Audio from applications running in the background. Otherwise, Audio from background applications continues to play alongside your Unity application. | |
Prepare iOS for Recording | Enable this option to initialize the microphone recording APIs. This lowers recording latency, but it also re-routes iPhone audio output via earphones. | |
Force iOS Speakers when Recording | Enable this option to send the phone’s audio output through the internal speakers, even when headphones are plugged in and recording. | |
Requires Persistent WiFi | Enable this option to require a Wi-Fi connection. This maintains the active Wi-Fi connection while the app is running. | |
Supported URL schemes | A list of supported URL schemes. To add new schemes, increase the value of the Size property, then set a reference to the Asset to load in the new Element box that appears. |
设置 | 功能 | |
---|---|---|
Target Device | 选择应用程序的目标设备。选项包括 iPhone Only、iPad Only 和 iPhone + iPad。 | |
Target SDK | 选择应用程序所针对的 SDK。选项包括 Device SDK 和 Simulator SDK。 注意:请务必选择正确的 SDK。例如,如果在 Unity 中选择 Device SDK 并在 Xcode 中以 Simulator 为目标,那么构建将失败。 |
|
Target minimum iOS Version | 选择运行应用程序所需要的最低 iOS 版本。 | |
Enable ProMotion Support | 启用此选项可在 ProMotion 显示屏上允许高频刷新率 (120 Hz)。这可能会导致您的应用程序消耗更多的电池电量。 | |
Requires ARKit support | 启用此选项可在应用程序发布到 App Store 时将目标设备限制为 iPhone 6s/iOS 11 或更新款的设备。 | |
Automatically add capabilities | 启用此选项后,Unity 会生成一个 entitlements.plist 文件,并为应用程序所实现的 iOS API(例如 Game Center 或 Notifications)添加功能。有关更多信息,请参阅 Apple 开发者文档的授权 (Entitlements) 部分。 | |
Defer system gestures on edges | 选择一个或多个边缘,用户必须轻扫两次相应的边缘才能作为系统手势。选项包括 Top Edge、Left Edge、Bottom Edge 和 Right Edge | |
Hide home button on iPhone X | 启用此选项可在应用程序运行时隐藏 iPhone X 设备上的主屏幕按钮。 | |
Render Extra Frame on Pause | Enable this option to issue an additional frame after the frame when the app is paused. This allows your app to display graphics that indicate the paused state when the app goes into the background. | |
Enable Custom Background Behaviors | Select what the app is allowed to do when the user presses the home button to send the app to the background. For an example, see the BackgroundFetch GitHub project. The options are: - Audio, AirPlay, PiP - Location updates - Voice over IP - Newsstand downloads - External accessory communication - Uses Bluetooth LE accessories - Act as a Bluetooth LE accessory - Background fetch - Remote notifications |
展开 Variant map for app slicing 部分可查看脚本中配置的变体名称列表。有关变体的更多信息,请参阅应用程序切片。
注意:如果未显示该部分,请确保已启用 Use on Demand Resource 属性。
可以使用加号 (+) 和减号 (-) 图标添加和删除新变体。还可以从列表中选择变体,并在 Variant settings 下查看或修改其设置。对于任何的这些设置(Variant name 除外),如果选择 Custom value,则会在其下方显示一个附加属性,然后可在其中输入要使用的值:
设置 | 功能 |
---|---|
Variant name | 显示加载脚本中变体的名称。 |
设备 | 选择此变体所针对的设备。选项包括 Any_(默认值)、iPhone、iPad、iWatch_ 和 Custom value。 |
Memory | 选择此变体所需的最小内存。选项包括 Any_(默认值)、1GB、2GB、3GB、4GB_ 和 Custom value。 |
Graphics | 选择要使用的 Metal 框架。选项包括 Any_(默认值)、Metal1v2、Metal2v2、Metal2v3、Metal3v1、Metal3v2、Metal4v1_ 和 Custom value。 有关更多信息,请参阅 Apple 开发者文档的 Metal 部分。 |
Display color space | 选择要使用的色域。选项包括 Any_(默认值)、sRGB、DisplayP3_ 和 Custom value。 |
也可以添加自己的设置。单击 Add custom entry 按钮,然后将出现一对新文本框:
Setting | Function | |
---|---|---|
Architecture | Choose which architecture to target. This setting defaults to ARM64 for iOS and can’t be changed. | |
Active Input Handling | Choose how to handle input from users. | |
Input Manager (old) | Use the default Input window. | |
Input System Package (New) | Use the newer Input system. To try the new Input System, install the InputSystem package. | |
Both | Use both systems side by side. |
Use these settings to control how much memory shaders use at runtime.
设置 | 描述 |
---|---|
Default chunk size (MB) | Sets the maximum size of compressed shader variant data chunks Unity stores in your built application for all platforms. The default is 16 . Refer to Shader loading for more information. |
Default chunk count | Sets the default limit on how many decompressed chunks Unity keeps in memory on all platforms. The default is 0 , which means there’s no limit. |
Override | Enables overriding Default chunk size and Default chunk count for this build target. |
Chunk size (MB) | Overrides the value of Default chunk size (MB) on this build target. |
Chunk count | Overrides the value of Default chunk count on this build target. |
属性 | 描述 |
---|---|
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. |
Setting | Function | |
---|---|---|
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, refer to ManagedStrippingLevel. |
|
Script Call Optimization | Choose how to optionally disable exception handling for a speed boost at run time. For more information, see iOS Optimization. | |
Slow and Safe | Use full exception handling (with some performance impact on the device when using the Mono scripting backend). | |
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 | 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, refe to 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. Refer to PlayerSettings.stripUnusedMeshComponents for more information. |
|
Strict shader variant matching | If a shader variant is missing, the editor uses the bright pink error shader whilst displaying an error message in the Console. | |
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. |
选择在特定上下文中允许的日志记录类型。
See stack trace logging for more information.
启用 Clamp BlendShapes (Deprecated) 选项可在 SkinnedMeshRenderers 中钳制混合形状权重的范围。此选项已弃用,不应再使用。