compileSdkVersion
The API level to compile your application against.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Property
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static AndroidSdkVersionFull compileSdkVersion { get; set; }
Remarks
This value must be higher than or equal to . Set this to AndroidSdkVersionFull.AndroidApiLevelAuto (or 0, or null) to compile against the highest Android SDK platform installed on your machine, independently of PlayerSettings.Android.targetSdkVersion.
targetSdkVersionExamples
using UnityEngine;using UnityEditor;using UnityEditor.Build;public class CompileSdkVersionSample : MonoBehaviour{ [MenuItem("Build/CompileSdkVersion Sample")] public static void BuildCompileSdkVersionSample() { PlayerSettings.SetScriptingBackend(NamedBuildTarget.Android, ScriptingImplementation.IL2CPP); PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64; //Set compileSdkVersion to API level 36.1 PlayerSettings.Android.compileSdkVersion = new AndroidSdkVersionFull(36, 1); BuildPlayerOptions 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); }}