diff --git a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs index 9c89748b7..9002bc28b 100644 --- a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs +++ b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs @@ -445,12 +445,13 @@ public static void Alert(string title, string message) public static string GetAndroidSdkPath() { string sdkPath = EditorPrefs.GetString("AndroidSdkRoot"); +#if UNITY_2019 // Unity 2019.x added installation of the Android SDK in the AndroidPlayer directory // so fallback to searching for it there. - if (String.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded")) + if (string.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded")) { string androidPlayerDir = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None); - if (!String.IsNullOrEmpty(androidPlayerDir)) + if (!string.IsNullOrEmpty(androidPlayerDir)) { string androidPlayerSdkDir = Path.Combine(androidPlayerDir, "SDK"); if (Directory.Exists(androidPlayerSdkDir)) @@ -459,6 +460,12 @@ public static string GetAndroidSdkPath() } } } +#endif + if (sdkPath != null && (sdkPath.EndsWith("/") || sdkPath.EndsWith("\\"))) + { + sdkPath = sdkPath.Substring(0, sdkPath.Length - 1); + } + return sdkPath; }