This page details the Player Settings for the Android platform. For a description of the general Player settings, see Player Settings.
有关属性的描述根据 Player UI 中的相应部分进行分组:
Use the Icon section to specify icons to represent your application on the device.
设置 | 描述 |
---|---|
Adaptive | Specify textures of various sizes to represent your application on devices running Android 8.0 (API level 26) or higher. |
Round | Specify textures of various sizes to represent your application on devices running Android 7.1 (API level 25) or higher. |
Legacy | Specify textures of various sizes to represent your application on devices running versions earlier than Android 7.1 (API level 25). |
Use the Resolution and Presentation section to customize aspects of the screen’s appearance.
设置 | 描述 | |
---|---|---|
Fullscreen Mode | Specifies how the window appears on the device. This sets the default window mode at startup. | |
Fullscreen Window | The application window fills the full-screen native resolution of the device. To fill the full-screen window, Unity scales the application contents. Resolution Scaling Mode controls how Unity scales the contents. In this mode, the navigation bar is always hidden. | |
Windowed | The application uses a standard, non-full-screen, movable window. The size of the window depends on the application’s resolution. In this mode, the window is resizable by default. To disable this, disable Resizable Window. | |
Resizable Window | Indicates whether the user can resize the application’s window. This setting enables multi-window capabilities in your application on Android phones and tablets. For more information, see Google’s developer documentation. |
|
Default Window Width | The default width of the application window in pixels. This option is only available if the Fullscreen Mode is set to Windowed. | |
Default Window Height | The default height of the application window in pixels. This option is only available if the Fullscreen Mode is set to Windowed. | |
Minimum Window Width | The minimum width of the application window in pixels. This option is only available if the Fullscreen Mode is set to Windowed. | |
Minimum Window Height | The minimum height of the application window in pixels. This option is only available if the Fullscreen Mode is set to Windowed. | |
Hide Navigation Bar | Indicates whether to hide the navigation bar that appears at the top of the window. | |
Render outside safe area | Indicates whether the application should use all available screen space to render, including areas of the display that are cut out (notched). For more information, see Android’s display cutout support documentation. | |
Optimized Frame Pacing | Indicates whether Unity should evenly distribute frames for less variance in framerate. Enable this option to create a smoother experience. |
Other Resolution and Presentation settings are grouped under the following sections:
Use the Resolution Scaling section to customize settings relating to screen resolution scaling. Using a resolution lower than the device’s native resolution can improve performance and battery life.
设置 | 描述 | |
---|---|---|
Resolution Scaling Mode | Specifies whether and how the application scales its resolution. You can set the scaling to be equal to or lower than the native screen resolution. Using a lower resolution can improve performance and battery life. | |
Disabled | Doesn’t apply resolution scaling and the application renders to the device’s native screen resolution. | |
FixedDPI | Applies resolution scaling using a target API. Use this to optimize performance and battery life or target a specific DPI setting. | |
Letterboxed | Adds black bars to the rendered output so the content doesn’t stretch. This process is called letterboxing. | |
Target DPI | The resolution of the application. If the device’s native screen DPI is higher than this value, Unity downscales the application’s resolution to match this setting. To calculate the scale, Unity uses the following:min(Target DPI * Factor / Screen DPI, 1) Where Factor is the Resolution Scaling Fixed DPI Factor from Quality settings.Note: This option only appears when you set Resolution Scaling Mode to Fixed DPI. |
|
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. | |
Blit Type | Controls whether to use a blit to render the final image to the screen. Using a blit is compatible with most devices but is usually slower than not using a blit. | |
Always | Unity renders to an offscreen buffer and then uses a blit to copy the contents of the buffer to the device’s framebuffer. This is compatible with most devices but is usually slower than not using blit. | |
Never | Unity renders to the framebuffer provided by the device’s operating system. If this fails, the application prints a one-time warning to the device log. This is usually faster than using blit, but it isn’t compatible with all devices. | |
Auto | Unity renders to the framebuffer provided by the device’s operating system if possible. If this fails, Unity prints a warning to the device console and uses a blit to render the final image to the screen. |
Use the Supported Aspect Ratio section to customize settings relating to which device aspect ratios to support.
设置 | 描述 | |
---|---|---|
Aspect Ratio Mode | Specifies the largest aspect ratio the application supports. If the device’s aspect ratio is greater than this aspect ratio, Unity uses this aspect ratio for the application and adds black bars so the application doesn’t stretch.. | |
Legacy Wide Screen (1.86) | The application supports aspect ratios up to Android’s legacy wide-screen aspect ratio. | |
Native Aspect Ratio | The application supports aspect ratios up to Android’s native aspect ratio. | |
Custom | The application supports aspect ratios up to the aspect ratio you set in Up To. | |
Up To | The custom maximum aspect ratio. This setting only appears when you set Aspect Ratio Mode to Custom. |
Use the Orientation section to customize settings relating to the orientation of the application on the device.
从 Default Orientation 下拉菜单中选择游戏的屏幕方向:
设置 | 描述 | |
---|---|---|
Default Orientation | Specifies the screen orientation the application uses. Note: Unity shares the value you set for this setting between Android and iOS. |
|
Portrait | The application uses portrait screen orientation where the bottom of the application’s window aligns with the bottom of the device’s screen. | |
Portrait Upside Down | The application uses portrait screen orientation where the bottom of the application’s window aligns with the top of the device’s screen. | |
Landscape Right | The application uses landscape screen orientation where the right side of the application’s window aligns with the bottom of the device’s screen. | |
Landscape Left | The application uses landscape screen orientation where the right side of the application’s window aligns with the top of the device’s screen. | |
Auto Rotation | The screen can rotate to any of the orientations you specify in the Allowed Orientations for Auto Rotation section. |
Use the Allowed Orientations for Auto Rotation section to specify which orientations the application supports when you set Default Orientation to Auto Rotation. This is useful, for example, to lock the application to landscape orientation but allow the user to switch between landscape left and landscape right.
This section only appears when you set Default Orientation to Auto Rotation.
设置 | 描述 |
---|---|
Portrait | Indicates whether the application supports portrait screen orientation where the bottom of the application’s window aligns with the bottom of the device’s screen. |
Portrait Upside Down | Indicates whether the application supports portrait screen orientation where the bottom of the application’s window aligns with the top of the device’s screen. |
Landscape Right | Indicates whether the application supports landscape screen orientation where the right side of the application’s window aligns with the bottom of the device’s screen. |
Landscape Left | Indicates whether the application supports landscape screen orientation where the right side of the application’s window aligns with the top of the device’s screen. |
The Resolution and Presentation section also contains the following general settings.
设置 | 描述 | |
---|---|---|
Use 32-bit Display Buffer | Indicates whether the display buffer holds 32-bit color values instead of 16-bit color values. Enable this setting if you see banding, or need alpha values in post-processing effects. Some post-processing effects require this because they create Render Textures in the same format as the display buffer. | |
Disable Depth and Stencil | Indicates whether to disable depth and stencil buffers. | |
Render Over Native UI | Indicates whether to render on top of native UI on Android or iOS. For this setting to take effect, set your Camera’s Clear Flags to use a solid color with an alpha value lower than 1. | |
Show Loading Indicator | Specifies if and how the loading indicator appears. | |
Don’t Show | The loading indicator doesn’t appear. | |
Large | A large loading indicator appears. | |
Inversed Large | A large loading indicator appears with inversed color. | |
Small | A small loading indicator appears. | |
Inversed Small | A small loading indicator appears with inversed color. |
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 Screen 设置,可以设置特定于 Android 的 Static Splash Image 选项。
设置 | 描述 | |
---|---|---|
Image | Specifies the texture that the application uses for the Android splash screen. The standard size for the splash screen image is 320x480. | |
Scaling | Specifies how to scale the splash image to fit the devic’es screen. | |
Center (only scale down | Draws the image at its native size unless it’s too large, in which case Unity scales the image down to fit. | |
Scale to Fit (letter-boxed) | Scales the image so that the longer dimension fits the screen size exactly. Unity fills in the empty space around the sides in the shorter dimension in black. | |
Scale to Fill (cropped) | Scales the image so that the shorter dimension fits the screen size exactly. Unity crops the image in the longer dimension. |
此部分可以自定义一系列选项,这些选项分为以下几组:
使用这些设置可自定义 Unity 针对 Android 平台渲染游戏的方式。
设置 | 功能 | |
---|---|---|
Color Space | 选择应该用于渲染的颜色空间,选项为:_Gamma_ 或 Linear。 请参阅线性渲染概述以了解这两者之间的区别。 |
|
Auto Graphics API | 禁用此选项可手动设置图形 API。此选项在默认情况下为启用状态,并包含 Metal。 | |
Color Gamut | 可以为 iOS 平台添加或删除色域以用于渲染。单击加号 (+) 图标查看可用色域的列表。色域定义了给定设备(如监视器或屏幕)可以使用的所有颜色范围。sRGB 色域是默认色域(也是必需色域)。 如果目标设备是具备宽色域显示屏的新款 tvOS 设备,请使用 DisplayP3 充分利用显示能力。对于旧设备,使用 Metal Editor Support 作为后备选项。 |
|
Multithreaded Rendering | 启用此选项可使用多线程渲染。仅 Metal 支持此功能。 | |
Static Batching | 启用此选项可使用静态批处理。 | |
Dynamic Batching | 选中此复选框可在构建中使用动态批处理(默认情况下启用)。 | |
Compute Skinning | Enable this option to use DX11/DX12/ES3 GPU compute skinning, which frees up CPU resources. | |
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 | 选择 XYZ 或 DXT5nm 样式_对法线贴图编码进行设置。此设置影响用于法线贴图的编码方案和压缩格式。DXT5nm 样式_的法线贴图质量更高,但在着色器中解码成本更高。 | |
Lightmap Encoding | 选择 Low Quality、Normal Quality 或 High 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 帧时序统计信息。 | |
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. | |
Load/Store Action Debug Mode | Highlights undefined pixels that may cause rendering problems on mobile platforms. This affects the Unity Editor 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 in the Editor, but not your built application. |
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. |
Apply display rotation during rendering | Enable this to perform all rendering in the native orientation of the display. This has a performance benefit on many devices. For more information, see documentation on Framebuffer orientation. |
属性 | 功能 |
---|---|
Override Default Package Name | Indicates whether to override the default package name for your application. Note: This setting affects macOS, iOS, tvOS, and Android. |
Package Name | Set the application ID, which uniquely identifies your app on the device and in Google Play Store. The application ID must follow the convention com.YourCompanyName.YourProductName and must contain only alphanumeric and underscore characters. Each segment must start with an alphabetical character. For more information, see Set the application ID.Important: Unity automatically removes any invalid characters you type. To set this property, enable Override Default Package Name. |
Version | 输入捆绑包的构建版本号,用于标识捆绑包的迭代(已发布或未发布)。版本以通用格式指定,该格式包含以点号分隔的数字的字符串(例如,4.3.2)。(在 iOS 和 Android 之间共享。) |
Bundle Version Code | 内部版本号。此数字仅用于确定一个版本是否比另一个版本更新,数字更大表示版本越新。这不是向用户显示的版本号;向用户显示的版本号由 versionName 属性设置。该值必须设置为整数,例如“100”。您可以根据需要定义,只要每个后续版本具有更高的数字即可。例如,它可以是构建版本号。或者,可以通过在低 16 位和高 16 位分别编码“x”和“y”将“x.y”格式的版本号转换为整数。或者,每次发布新版本时,只需将数字加一。 如果启用了 Split APKs by target architecture,请将此数字保持在 100000 以下。每个 APK 必须具有唯一的版本代码,因此 Unity 为 ARMv7 添加 100000,为 ARM64 添加 200000。 |
Minimum API Level | 运行应用程序所需的最低 Android 版本(API 级别)。 |
Target API Level | 编译应用程序针对的目标 Android 版本(API 级别)。 |
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, refer to the Mono page. | |
IL2CPP | Compiles C# code into CIL, converts the CIL to C++ and then compiles that C++ into native machine code, which executes directly at runtime. Refer to 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 2.0 | .Net 2.0 libraries. Maximum .net compatibility, biggest file sizes. Part of the deprecated .NET 3.5 runtime. | |
.Net 2.0 Subset | Subset of full .net compatibility, smaller file sizes. Part of the deprecated .NET 3.5 runtime. | |
.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 | 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, refer to Automatic Memory Management. | |
Assembly Version Validation | Indicates whether Mono validates types from a strongly-named assembly. | |
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. | |
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. | |
Target Architectures | Select which CPUs you want to allow the application to run on (32-bit ARM, 64-bit ARM, 32-bit x86, and 64-bit x86–64). Note: Running Android apps in a 64-bit environment has performance benefits and 64-bit apps can address more than 4 GB of memory space. |
|
Split APKs by target architecture (Experimental) | Enable this option to create a separate APK for each CPU architecture selected in Target Architectures. This makes download size smaller for Google Play Store users. This is primarily a Google Play store feature and may not work in other stores. For more details, refer to Multiple APK Support. | |
Target Devices | Specifies the target devices on which the APK is allowed to run. | |
All Devices | The APK is allowed to run on all Android and Chrome OS devices. | |
Phones and Tablets Only | The APK is allowed to run on Android phones and tablets, but not on Chrome OS devices. | |
Chrome OS Devices Only | The APK is allowed to run on Chrome OS devices, but not on Android phones or tablets. | |
Install Location | Specifies application install location on the device (for detailed information, refer to Android Developer documentation on install locations. | |
Automatic | Let the operating system decide. User will be able to move the app back and forth. | |
Prefer External | Install the application to external storage (SD card) if possible. The operating system doesn’t guarantee it; if not possible, the app will be installed to internal memory. | |
Force Internal | Force the application to be installed to internal memory. The user will be unable to move the app to external storage. | |
Internet Access | Choose whether to always add the networking (INTERNET ) permission to the Android App Manifest, even if you are not using any networking APIs. Set to Require by default for development builds. |
|
Auto | Only add the internet access permission if you are using a networking API. | |
Require | Always add the internet access permission. | |
Write Permission | Choose whether to enable write access to the external storage (such as the SD card) and add a corresponding permission to the Android App Manifest. Set to External(SDCard) by default for development builds. | |
Internal | Only grant write permission to internal storage. | |
External(SDCard) | Enable write permission to external storage. | |
Filter Touches When Obscured | Enable this option to discard touches received when another visible window is covering the Unity application. This is to prevent tapjacking. | |
Sustained Performance Mode | Enable this option to set a predictable and consistent level of device performance over longer periods of time, without thermal throttling. Overall performance might be lower when this setting is enabled. Based on the Android Sustained Performance API. | |
Maximum Java Heap Size | Set the maximum Java heap size to user for building (in megabytes). Defaults to 4096. | |
Low Accuracy Location | Enable this option to use low accuracy values with Android location APIs instead. | |
Chrome OS Input Emulation | Chrome OS’s default behaviour is to convert mouse and touchpad input events into touchscreen input events. Un-check this setting to disable the default behavior. | |
Android TV Compatibility | Enable this option to mark the application as Android TV compatible. | |
Android Game | Enable this option to mark the output package (APK) as a game rather than a regular application. | |
Android Gamepad Support Level | Choose the level of support your application offers for a gamepad. The options are Works with D-Pad, Supports Gamepad, and Requires Gamepad. | |
Warn about App Bundle size | Enable this option to receive a warning when the size of the Android App Bundle exceeds a certain threshold. This option is selected by default and you can only configure it if you enable the Build App Bundle (Google Play) option in the Build settings. | |
App Bundle size threshold | Enter a size in Mb. When your App Bundle exceeds this size, Unity will display a warning. | |
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. |
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:
Frameworks/Mono/lib/mono/YOURSUBSET/
.属性 | 描述 |
---|---|
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. |
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, refer to ManagedStrippingLevel. |
|
Enable Internal profiler (Deprecated) | Enable this option to get the profiler data from your device in the Android SDK’s adblogcat output while testing your projects. This is only available in development 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. |
|
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 中钳制混合形状权重的范围。
Use the Publishing Settings to configure how Unity builds your Android app. To open the Publishing Settings, go to Edit > Project Settings, select Player, select the Android icon, and open the Publishing Settings panel.
此部分介绍 Publishing Settings 面板的不同部分及其功能。这些资源包括:
注意:出于安全原因,Unity 不会保存密钥库或项目密钥密码。
Use the Keystore Manager window to create, configure and load your keys and keystores. You can load existing keystores and keys from either the Keystore Manager or the main Android Publishing panel. If you choose to load these from inside the Keystore Manager, Unity automatically fills the Project Keystore and Project Key fields. For further information see documentation on the Keystore Manager.
密钥库是用于保存签名密钥来实现应用程序安全性的容器。有关详细信息,请参阅 Android 开发者文档:Android 密钥库系统。
Use the Project Keystore settings to choose which keystore to use for the open project. When you load a keystore, Unity loads all of the keys in that keystore. To load and use an existing keystore in your open project:
如果没有现有密钥库,请将 Custom Keystore 保留为禁用状态。
Unity 使用调试密钥库对应用程序进行签名。 调试密钥库是一种工作密钥库。通过它可以对应用程序进行签名并在本地进行测试。但是,应用商店会拒绝以这种方式签名的应用程序。这是因为应用商店无法使用调试密钥库验证应用程序的有效性和所有权。
属性 | 描述 |
---|---|
Custom Keystore | 启用 Custom Keystore 可加载和使用现有密钥库。 |
Select | When Custom Keystore is enabled, use this to select the keystore you want to use. The keystores below the partition in the Select dropdown are stored in a predefined dedicated location. For more details, see Choose the keystore location. |
路径 | 无需输入密钥库路径。Unity 会基于所选择的密钥库提供此路径。 |
Password | 输入密钥库密码以加载所选的密钥库。 |
加载密钥库时,Unity 会加载该密钥库中的所有密钥。使用 Project Key 设置可从该密钥库中选择一个密钥以用作打开的项目的活动密钥。
属性 | 描述 |
---|---|
Alias | 选择要用于打开的项目的密钥。 |
Password | 输入密钥密码。 |
By default, Unity builds your application with the manifest files, Gradle templates and Proguard files provided with the Unity installation. Use the Build section of the Android Publishing Settings to change these.
To use a custom manifest file, Gradle template or Proguard file:
Build 部分中的设置仅适用于当前项目的构建过程。
属性 | 描述 |
---|---|
Custom Main Manifest | Customizable version of the Android LibraryManifest.xml file. This file contains important metadata about your Android application. For more information about the responsibilities of the Main/Unity Library Manifest see Unity Library Manifest. |
Custom Unity Launcher Manifest | Customizable version of the Android LauncherManifest.xml file. This file contains important metadata about your Android application’s launcher. For more information about the responsibilities of the Unity Launcher Manifest see Unity Launcher Manifest. |
Custom Main Gradle Template | Customizable version of the mainTemplate.gradle file. This file contains information on how to build your Android application as a library. For more information see documentation on Gradle project files. |
Custom Launcher Gradle Template | Customizable version of the launcherTemplate.gradle_ file. This file contains instructions on how to build your Android application. For more information see documentation on Gradle project files. |
Custom Base Gradle Template | Customizable version of the baseProjectTemplate.gradle file. This file contains configuration that is shared between all other templates and Gradle projects. For more information see documentation on Gradle project files. |
Custom Gradle Properties Template | Customizable version of the gradle.properties file. This file contains configuration settings for the Gradle build environment. This includes: • The JVM (Java Virtual Machine) memory configuration. • A property to allow Gradle to build using multiple JVMs. • A property for choosing the tool to do the minification. • A property to not compress native libs when building an app bundle. |
Custom Proguard File | Customizable version of the proguard.txt file. This file contains configuration settings for the minification process. If minification removes some Java code which should be kept, you should add a rule to keep that code in this file. For more information see documentation on Minification. |
缩小是一种缩减、混淆和优化应用程序代码的过程。它可以减小代码大小并使代码更难以反汇编。使用 Minify 设置可定义 Unity 应何时以及如何将缩小应用于构建。
在大多数情况下,仅将缩小应用于发布构建(而不是调试构建)是一种很好的做法。这是因为缩小需要时间,可能会使构建速度变慢。由于代码经过优化,它还会使调试更加复杂。
Minify 部分中的设置仅适用于当前项目的构建过程。
属性 | 描述 |
---|---|
Use R8 | 默认情况下,Unity 使用 Proguard 进行缩小。启用此复选框可改为使用 R8。 |
Release | 如果希望 Unity 在发布构建中缩小应用程序的代码,请启用此复选框。 |
Debug | 如果希望 Unity 在调试构建中缩小应用程序的代码,请启用此复选框。 |
启用 Split Application Binary 选项可将输出包拆分为主包 (APK) 和扩展包 (OBB) 包。如果要发布大于 100 MB 的应用程序,则 Google Play 应用商店需要此功能。