概要
using UnityEditor; using UnityEditor.Android; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { Debug.Log( AndroidExternalToolsSettings.ndkRootPath ); Debug.Log( AndroidExternalToolsSettings.sdkRootPath ); Debug.Log( AndroidExternalToolsSettings.jdkRootPath ); Debug.Log( AndroidExternalToolsSettings.gradlePath ); } }
上記のようなコードを記述することで
C:/Program Files/Unity/Hub/Editor/2019.3.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK C:/Program Files/Unity/Hub/Editor/2019.3.2f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK C:/Program Files/Unity/Hub/Editor/2019.3.2f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK C:/Program Files/Unity/Hub/Editor/2019.3.2f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle
このように Android SDK や Android NDK、JDK、Gradle のパスを取得できます