Path to the Android Software Development Kit (SDK) used for building Android applications.
using UnityEngine; using UnityEditor; using UnityEditor.Android;
public class SdkPathManager { [MenuItem("Build/Set Custom SDK Path")] public static void SetSdkPath() { // Set a custom path for the Software Development Kit (SDK) string customSdkPath = "/path/to/your/sdk";
AndroidExternalToolsSettings.sdkRootPath = customSdkPath; Debug.Log($"SDK Path set to: {AndroidExternalToolsSettings.sdkRootPath}"); }
[MenuItem("Build/Reset SDK Path To Default")] public static void ResetSdkPath() { // Reset SDK path to Unity's default AndroidExternalToolsSettings.sdkRootPath = string.Empty; Debug.Log("SDK Path reset to 'Installed with Unity (recommended)' path."); }
[MenuItem("Build/Get Current SDK Path")] public static void GetSdkPath() { // Retrieve the currently configured SDK path string currentSdkPath = AndroidExternalToolsSettings.sdkRootPath;
Debug.Log($"Current SDK Path: {currentSdkPath}");
} }