Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PlayerSettings.Android

Android specific Player settings.
Read time 3 minutesLast updated 3 days ago

Definition

  • Type: Class
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public class PlayerSettings.Android

Remarks

Use these settings to configure how Unity builds and displays your final application for the Android platform.

Examples

using UnityEngine;using UnityEditor;public class AndroidPlayerSettingsSamples : MonoBehaviour{ [MenuItem("Tools/Set Android Player settings")] public static void SetAndroidPlayerSettings() { // Set autoRotation behaviour value to user or sensor PlayerSettings.Android.autoRotationBehavior = AndroidAutoRotationBehavior.User; // Log the current value of autoRotationBehavior Debug.Log($"autoRotationBehavior: {PlayerSettings.Android.autoRotationBehavior}"); // Set min aspect ratio to 2.0f PlayerSettings.Android.minAspectRatio = 2.0f; // Log the minimum aspect ratio Debug.Log($"minAspectRatio: {PlayerSettings.Android.minAspectRatio}"); // Set minimum SDK version PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel30; // Log the minimum SDK version Debug.Log($"minSdkVersion: {PlayerSettings.Android.minSdkVersion}"); // Set targetSdkversion PlayerSettings.Android.targetSdkVersion = AndroidSdkVersions.AndroidApiLevel30; // Log the targetSdkVersion setting Debug.Log($"targetSdkVersion: {PlayerSettings.Android.targetSdkVersion}"); // Set textureCompressionFormats to ETC2 and ASTC texture formats PlayerSettings.Android.textureCompressionFormats = new TextureCompressionFormat[] { TextureCompressionFormat.ETC2, TextureCompressionFormat.ASTC }; // Log each configured texture compression format foreach (TextureCompressionFormat format in PlayerSettings.Android.textureCompressionFormats) { Debug.Log($"Configured Texture Compression Format: {format}"); } }}

Static Properties

Property

Description

androidTVCompatibilityProvide a build that is Android TV compatible.
androidVulkanAllowFilterListSpecifies a list of AndroidDeviceFilterData parameters to allow Android devices to always use Vulkan API when running Unity applications.
androidVulkanDenyFilterListSpecifies a list of AndroidDeviceFilterData parameters to restrict Android devices from using Vulkan API when running Unity applications.
appCategorySpecify the category for your application that best represents its primary functionality.
applicationEntryApplication entry classes to include.
ARCoreEnabledEnable support for Google ARCore on supported devices.
autoRotationBehaviorIndicate whether your application window rotates based on device orientation settings (User) or device orientation sensor (Sensor), when default orientation is Auto Rotation.
blitTypeChoose how content is drawn to the screen.
buildApkPerCpuArchitectureCreate a separate APK for each CPU architecture.
bundleVersionCodeAndroid bundle version code.
defaultWindowHeightThe default vertical size of the Android Player window in pixels.
defaultWindowWidthThe default horizontal size of the Android Player window in pixels.
disableDepthAndStencilBuffersDisable Depth and Stencil Buffers.
displayOptionsDefines Android display settings that determine how your application renders on the Android devices at runtime.
enableArmv9SecurityFeaturesEnable Armv9 security features, including Pointer Authentication (PAuth, PAC) and Branch Target Identification (BTI) for Arm64 builds.
forceInternetPermissionForce internet permission flag.
forceSDCardPermissionForce SD card permission.
fullscreenModeThe display mode for Android Player builds of your application.
keyaliasNameAndroid key alias name.
keyaliasPassPassword for the key used for signing an Android application.
keystoreNameContains the path to the Android keystore file.
keystorePassAndroid keystore password.
maxAspectRatioMaximum aspect ratio supported by the application.
minAspectRatioMinimum aspect ratio which is supported by the application.
minifyDebugEnable to minify debug build.
minifyReleaseEnable to minify release build.
minimumWindowHeightThe minimum vertical size of the Android Player window in pixels.
minimumWindowWidthThe minimum horizontal size of the Android Player window in pixels.
minSdkVersionThe minimum API level required for your application to run.
optimizedFramePacingEnable optimized frame pacing.
predictiveBackSupportEnable to use Android's OnBackInvokedCallback for handling back events on Android 13 and above.
preferredInstallLocationPreferred application install location.
renderOutsideSafeAreaExtends rendering layout into display cutout area, utilizing all of the available screen space.
reportGooglePlayAppDependenciesIndicates whether to track application dependencies for Google Play Store verification.
resizeableActivityIndicates whether your Android application is resizable.
runWithoutFocusAllows your application to continue to run even when it’s not in focus.
showActivityIndicatorOnLoadingApplication should show ActivityIndicator when loading.
splashScreenScaleAndroid splash screen scale mode.
splitApplicationBinarySplit application binary into modules.
startInFullscreenStart in fullscreen mode.
targetArchitecturesA set of CPU architectures for the Android build target.
targetSdkVersionThe target API level of your application.
textureCompressionFormatsTarget texture compression formats.
useCustomKeystoreEnable application signing with a custom keystore.