Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

AndroidPreferredInstallLocation

enumeration

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Options for preferred storage location for the application installation on Android devices.

These options indicate whether the application should be installed on an internal or external storage of the Android device. You can pass a value from this enum to PlayerSettings.Android.preferredInstallLocation.

using UnityEngine;
using UnityEditor;
using UnityEditor.Build;

public class PreferredInstallLocationSample : MonoBehaviour { [MenuItem("Build/Preferred Install Location Sample")] static void BuildPreferredInstallLocationSample() { PlayerSettings.SetScriptingBackend(NamedBuildTarget.Android, ScriptingImplementation.IL2CPP); PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;

// Set preferredInstallLocation to PreferExternal // This allows your app to be installed on external storage (SD card) PlayerSettings.Android.preferredInstallLocation = AndroidPreferredInstallLocation.PreferExternal;

var options = new BuildPlayerOptions(); options.scenes = new[] { "Assets/Scenes/SampleScene.unity" }; options.locationPathName = "Build/AndroidBuild.apk"; options.target = BuildTarget.Android; options.targetGroup = BuildTargetGroup.Android; BuildPipeline.BuildPlayer(options); } }

Properties

Property Description
AutoThe Android OS determines the install location. The application doesn't have any preferences.
PreferExternalPrefers application installation on external storage, if available.
ForceInternalForces the application to install into internal memory.