ドキュメント

Unity Engine

Unity Engine

AndroidPreferredInstallLocation

Options for preferred storage location for the application installation on Android devices.
読み終わるまでの所要時間 1 分最終更新 20日前

Definition

  • Type: Enum
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public enum AndroidPreferredInstallLocation

Remarks

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.

Examples

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); }}

Fields

Value

Description

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