Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

PlayerSettings.Android.compileSdkVersion

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

Switch to Manual
public static AndroidSdkVersionFull compileSdkVersion;

Description

The API level to compile your application against.

This value must be higher than or equal to targetSdkVersion. 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.

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