Android 单通道立体渲染
Android 2D Textures Overrides

Player settings for the Android platform

This page details the Player settings specific to the Android platform. For a description of the general Player settings, see the Player settings.

Android Player settings
Android Player settings

You can find documentation for the properties in the following sections:

Icon

The Icon section of the Android Player settings window
The Icon section of the Android Player settings window
Property Function
Adaptive Set up textures for the Android Adaptive icons in your app.
Round Set up textures for the Android Round icons in your app.
Legacy Set up textures for the Android Legacy icons in your app.
Enable Android Banner Enables a custom banner for Android TV builds.

Resolution and Presentation

Use the Resolution and Presentation section to customize aspects of the screen’s appearance.

Resolution and Presentation settings for the Android platform
Resolution and Presentation settings for the Android platform
Setting Function
Start in fullscreen mode Hide the navigation bar while the splash screen or first scene loads. When not set, the navigation bar appears while the splash screen or first scene loads.
Preserve framebuffer alpha Enable this option if you want Unity to render on top of native the Android UI. The camera’s Clear Flags have to be set to Solid color with an alpha less than 1 for this to have any effect. (OpenGL ES only).

Other Resolution and Presentation properties are grouped under these sections:

Resolution Scaling

Resolution Scaling settings for the Android platform
Resolution Scaling settings for the Android platform
Setting Function
Resolution Scaling Mode Allows you to set the scaling to be equal to or below the native screen resolution.
FixedDPI Allows you to scale the device’s screen resolution below its native resolution and show the Target DPI property. Use this to optimize performance and battery life or target a specific DPI setting.
Disabled Ensures that scaling is not applied and the game renders to its native screen resolution.
Target DPI Set the resolution 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. The scale is calculated as min(Target DPI * Factor / Screen DPI, 1). The Factor is controlled by the Resolution Scaling Fixed DPI Factor on the Quality window.
Note: This option only appears when the Resolution Scaling Mode is set to Fixed DPI.
Blit Type Controls whether a blit is used to render the final image to the screen.
Always (Always blit) Make Unity render to an offscreen buffer and then copy to the system framebuffer. This is compatible with most devices, but is usually slower than Never blitting.
Never (Never blit) Make Unity render to the framebuffer provided by the OS. If a condition arises during application run time that causes this to fail, the application will print a one-time warning to the device log. Never blitting is usually faster than Always blitting, but it’s not compatible with all devices.
Auto Make Unity render to the framebuffer provided by the OS, if possible. If a condition is met that prevents your application from rendering to the system framebuffer, the application switches to offscreen rendering and issues a warning to the device console.

Supported Aspect Ratio

Aspect Ratio Mode setting for the Android platform
Aspect Ratio Mode setting for the Android platform

Set the Aspect Ratio Mode for the device. You can choose from Legacy Wide Screen (1.86), Native Aspect Ratio, and Custom. When you choose Custom, the Up To field appears.

Set a custom maximum screen width with the Up To property. This property is only available when Aspect Ratio Mode is set to Custom.

Orientation

Default Orientation setting for the Android platform
Default Orientation setting for the Android platform

Choose the game’s screen orientation from the Default Orientation drop-down menu:

Setting Function
Portrait Home button appears at the bottom.
Portrait Upside Down Home button appears at the top.
Landscape Left Home button appears on the right side.
Landscape Right Home button appears on the left side.
Auto Rotation Allow the screen to automatically rotate to any of the orientations specified by the Allowed Orientations for Auto Rotation settings. This is the default.

Note: This setting is shared between iOS and Android devices.

When you set the orientation to Auto Rotation, the Allowed Orientations for Auto Rotation section appears.

Allowed Orientations for Auto Rotation

This section is only visible when Default Orientation is set to Auto Rotation.

Allowed Orientations for Auto Rotation Player settings for the Android platform
Allowed Orientations for Auto Rotation Player settings for the Android platform

Because Auto Rotation changes screen orientation to match the device, you may want to limit the screen orientations allowed (for example, locking a device to landscape).

Enable each orientation you want to allow by checking its box in this section:

Setting Function
Portrait Allow portrait orientation.
Portrait Upside Down Allow portrait upside-down orientation.
Landscape Right Allow landscape right orientation (home button on the left side).
Landscape Left Allow landscape left orientation (home button is on the right side).

Other

Other Resolution and Presentation settings for the Android platform
Other Resolution and Presentation settings for the Android platform
Setting Function
Use 32-bit Display Buffer Enable this option to create a Display Buffer to hold 32-bit color values (16-bit by default). Use it if you see banding, or need alpha in your post-processed effects, because they create Render Textures in the same format as the Display Buffer.
Disable Depth and Stencil Enable this option to disable the depth and stencil buffers.
Show Loading Indicator Select how the loading indicator should appear. The options are Don’t Show, Large, Inversed Large, Small and Inversed Small.

Splash Image

Above the common Splash Screen settings, you can use the Virtual Reality Splash Image setting to specify a custom splash image for Virtual Reality displays.

Splash Settings for the Android platform Player
Splash Settings for the Android platform Player

Below the common Splash Screen settings, you can set up an Android-specific Static Splash Image.

Use Storyboard for Launch Screen on the Android Player platform
Use Storyboard for Launch Screen on the Android Player platform

Use the Android Splash Screen property to specify the texture that should be used for the Android splash screen. The standard size for the splash screen image is 320x480.

Choose how you want Unity to scale the splash image to fit the device’s screen from the Splash Scaling drop-down menu. The options are:

  • Center (only scale down)
  • Scale to Fit (letter-boxed)
  • Scale to Fill (cropped)

Other Settings

This section allows you to customize a range of options organized into the following groups:

Rendering

Use these settings to customize how Unity renders your game for the Android platform.

Rendering settings for the Android platform
Rendering settings for the Android platform
Property Function
Color Space Choose which color space should be used for rendering: Gamma or Linear.
See the Linear rendering overview for an explanation of the difference between the two.
Auto Graphics API Disable this option to manually pick and reorder the graphics APIs from the Open Graphics Library (OpenGL). By default this option is enabled, and Unity tries GLES3.2. If the device does not support GLES3.2, Unity falls back to GLES3.1, GLES3 or GLES2. If only GLES3 is in the list, additional checkboxes appear: Require ES3.1, Require ES3.1+AEP and Require ES3.2. These allow you to force the corresponding graphics API.
Important: Unity adds the GLES3/GLES3.1/AEP/3.2 requirement to your Android manifest only if GLES2 is not in the list, and the Minimum API Level is set to JellyBean (API level 18) or higher. In this case only, your application won’t show up on unsupported devices in Google Play Store.
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 Enable this option to use Static batching on your build (enabled by default).
Dynamic Batching Enable this option to use Dynamic Batching on your build (enabled by default).
GPU Skinning Enable this option to use OpenGL ES 3 GPU skinning. To learn more about GPU skinning, see the Wikipedia page on skeletal animation.

Note: This property only supports VR apps, and only works if the Virtual Reality Supported checkbox is ticked.
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 may not deliver a performance improvement for your project, and may introduce instability.
Unity currently only supports Graphics Jobs when using Vulkan and this setting has no effect when using OpenGL ES.
Lightmap Streaming Enabled Enable this option to load only the lightmap mipmaps when needed. To render the current game Cameras, Unity applies this value to the lightmap textures when it generates the textures.
Note: To use this value, enable the Texture Streaming Quality setting.
Streaming Priority Define the lightmap mip map streaming priority when there’s contention for resources. The valid range is –127 to 128, where a positive number represent higher priority. This setting is only available when Lightmap Streaming Enabled is checked. To use this value, enable the Texture Streaming Quality setting.
Protect Graphics Memory Check this box to force the graphics buffer to be displayed only through a hardware-protected path. Works only on devices which support it.
Enable Frame Timing Stats Gather statistics on how much time a frame takes on the CPU and GPU.

Vulkan Settings

Enable the SRGB Write Mode option to allow Graphics.SetSRGBWrite() on Vulkan renderer to toggle the sRGB write mode during the frame.

Vulkan Player settings for the Android platform
Vulkan Player settings for the Android platform

Note: Enabling this feature may reduce performance, especially for tiled GPUs.

Identification

Identification settings for the Android platform
Identification settings for the Android platform
Property Function
Package Name Set the application ID, which uniquely identifies your app on the device and in Google Play Store. The basic structure of the identifier is com.CompanyName.AppName, and can be chosen arbitrarily. This setting is shared between iOS and Android.
Version Enter the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The version is specified in the common format of a string containing numbers separated by dots (eg, 4.3.2). (Shared between iOS and Android.)
Bundle Version Code An internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName attribute. The value must be set as an integer, such as “100”. You can define it however you want, as long as each successive version has a higher number.

For example, it could be a build number. Or you could translate a version number in “x.y” format to an integer by encoding the “x” and “y” separately in the lower and upper 16 bits. Or you could simply increase the number by one each time a new version is released.

Keep this number under 100000 if Split APKs by target architecture is enabled. Each APK must have a unique version code so Unity adds 100000 to the number for ARMv7, 200000 for ARM64 and 300000 for x86.
Minimum API Level Minimum Android version (API level) required to run the application.
Target API Level Target Android version (API level) against which to compile the application.

Configuration

Configuration settings for the Android platform
Configuration settings for the Android platform
Setting Function
Scripting Runtime Version Choose which .NET runtime to use in your project. For more details, see Microsoft’s .NET documentation.
.NET 3.5 Equivalent (Deprecated) A .NET runtime which implements the .NET 3.5 API. This functionality is deprecated, and should no longer be used. Please use .NET 4.
.NET 4.x Equivalent A .NET runtime which implements the .NET 4 API. This API is newer than .NET 3.5, and as such, it offers access to more APIs, is compatible with more external libraries, and supports C# 6. This is the default scripting runtime.
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. See the Mono Project website for more information.
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 can be used in your project. This setting can affect compatibility with 3rd-party libraries.
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 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.
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.
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.
Disable HW Statistics Enable this option to instruct the application not to send information about the hardware to Unity. By default, Unity Android applications send anonymous HW statistics to Unity. This provides you with aggregated information to help you make decisions as a developer.
Target Architectures Select which CPUs you want to allow the application to run on (32-bit ARM, 64-bit ARM, and 32-bit Intel).
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.
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 does not 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 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 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.
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.
Scripting Define Symbols Set custom compilation flags. For more details, see Platform dependent compilation.
Allow ‘unsafe’ Code Enable support for compiling ‘unsafe’ C# code in a pre-defined assembly (for example, Assembly-CSharp.dll).
For Assembly Definition Files (.asmdef), click on one of your .asmdef files and enable the option in the Inspector window that appears.
Active Input Handling Choose how you want to handle input from users.
Input Manager Use the traditional Input window.
Input System (Preview) Use the newer Input system. The Input System is under development. To try an early preview of the Input System, install the InputSystem package. If you select the Input System (Preview) option without having that package installed, nothing happens except for some extra processing.
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 is outside of your .NET compatibility level. In order to understand what is going on in such cases, and how to best fix it, try following these suggestions:

  1. Install Reflector for Windows.
  2. Drag the .NET assemblies for the API compatilibity level you are having issues with into Reflector. You can find these under Frameworks/Mono/lib/mono/YOURSUBSET/.
  3. Drag in your 3rd-party assembly.
  4. Right-click your 3rd-party assembly and select Analyze.
  5. In the analysis report, inspect the Depends on section. The report highlights anything that the 3rd-party assembly depends on, but that is not available in the .NET compatibility level of your choice in red.

Optimization

Optimization settings for the Android platform
Optimization settings for the Android platform
Setting Function
Prebake Collision Meshes Enable this option to add collision data to Meshes at build time.
Keep Loaded Shaders Alive Enable this option to prevent shaders from being unloaded.
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 and then set a reference to the Asset to load in the new Element box that appears.
Strip Engine Code (IL2CPP only) Specify whether the Unity Linker tool removes code for Unity Engine features that your Project does not use.
Managed Stripping Level Defines how aggressively Unity strips unused managed (C#) code.
When Unity builds your game or application, the Unity Linker process can strip unused code from the managed dynamically linked libraries used in the project. Stripping code can make the resulting executable significantly smaller, but can sometimes mistakenly remove code that is actually used. This setting allows you to choose how aggressively Unity should remove unused code.
Disabled (Mono only) Do not strip any code. (Managed code stripping is always enabled when using IL2CPP.)
Normal Remove unreachable managed code to reduce build size and Mono/IL2CPP build times.
Aggressive (Experimental) Remove code more aggressively than under the Normal option. Code size is further reduced, but this additional reduction may have side effects. For example, some methods may no longer be visible in the debugger and code accessed through reflection can be stripped. You can create a custom link.xml file to preserve specific classes and methods. See Managed bytecode stripping with IL2CPP for more information.
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.
Script Call Optimization Choose how to optionally disable exception handling for a speed boost at runtime. See iOS Optimization for details.
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 game runs faster when using the Mono scripting backend).
Note: Using this option with the IL2CPP Scripting Backend does not impact performance; however, using it can avoid undefined behavior on release builds.
Vertex Compression Set vertex compression per channel. For example, you can enable compression for everything except positions and lightmap UVs. Whole Mesh compression set per imported object overrides where vertex compression is set on objects. Everything else obeys these vertex compression settings.
Optimize Mesh Data Enable this option to remove any data from Meshes that is not required by the Material applied to them (such as tangents, normals, colors, and UVs).

Logging

Select what type of logging to allow in specific contexts.

Logging settings for Android platform
Logging settings for Android platform

Check one box that corresponds to each Log Type (Error, Assert, Warning, Log, and Exception) when running scripts (ScriptOnly) , all the time (Full), or never (None).

Legacy

Enable the Clamp BlendShapes (Deprecated) option to clamp the range of Blend Shape weights in SkinnedMeshRenderers.

Legacy settings for the Android platform
Legacy settings for the Android platform

Publishing Settings

Use these settings to customize building your Android app.

Note: For security reasons, Unity does not save the passwords on this page. The unsigned debug keystore is located by default at ~/.android/debug.keystore on MacOS and %USERPROFILE%\\.android\debug.keystore on Windows.

Keystore

To use an existing Keystore:

  1. Enable the Use Existing Keystore option.
  2. Click on the Browse Keystore button and select the Keystore from your filesystem.
  3. Enter your password in Keystore password.

Alternatively, you can create a new one:

  1. Enable the Create a new keystore option.
  2. Enter a password in Keystore password.
  3. Re-enter the password in Confirm password.

Key

Select your key from the Alias drop-down menu.

Once selected, you can enter your Password.

Build

Enable the Custom Gradle Template to customize the Gradle build process by providing your own changes to the Gradle build file, located here:
Assets/Plugins/Android/mainTemplate.gradle.

Enable the User Proguard File to use a Proguard file to shrink and optimize your app. For more information, see Gradle for Android. This file is located here:
Assets/Plugins/Android/proguard-user.txt

Minify

Specify whether you want to use Proguard or Gradle (Experimental) for minification, or None at all. Choose one of these options from the Release and Debug drop-down menus.

Enable the Split Application Binary option to split your output package into main (APK) and expansion (OBB) packages. This is required to publish applications larger than 100 MBytes to Google Play Store.

Enable Use Legacy SDK tools to use the deprecated Android SDK build tools to build the app. Selecting this option can increase build times.

XR Settings

XR Settings for the Android Player
XR Settings for the Android Player
Setting Function
Virtual Reality Supported Enable this if your application is a virtual reality application, then add the required VR SDKs to the list.
Virtual Reality SDKs Add and remove Virtual Reality SDKs from the list. This list is only available available when the Virtual Reality Supported is enabled.
To add an SDK to the list, click the plus (+) button.
To remove an SDK from the list, select it and then click the minus (-) button.
Some of the SDKs provide extra settings that appear here. For details, see XR SDKs.
Stereo Rendering Mode Choose how you want to render for a virtual reality device.
Multi Pass This is the normal rendering mode. Unity renders the Scene twice: first to render the left-eye image; and then again for the right-eye image.
Single Pass Multiview or Instanced (Preview) Render both eye images at the same time into one packed Render Texture. This means that the whole Scene is only rendered once, which significantly reduces CPU processing time.
ARCore Enable this option to use Google’s ARCore platform.
Vuforia Augmented Reality Supported Enable this option to use Vuforia Augmented Reality SDK, which is required when using the Vuforia Virtual Reality SDK.

XR Support Installers

XR Settings for the Android Player
XR Settings for the Android Player

You can click the Vuforia Augmented Reality link to enable the Vuforia Software Development Kit. You must have a Vuforia Software License and agree to the terms of that license before the Vuforia Augmented Reality Supported property is enabled.



  • 2018–10–19 Page amended with limited editorial review

  • Updated features in 5.5

  • Sustained Performance Mode added in 2017.3

  • .NET 4.x runtime added in 2018.1

  • Android Multiple APK features added in 2018.2

Android 单通道立体渲染
Android 2D Textures Overrides