From 139aa4a95f29a2109001ad52fdc869ab620cac85 Mon Sep 17 00:00:00 2001 From: lsw1164 Date: Wed, 25 May 2022 15:25:07 +0900 Subject: [PATCH] :bug: Fix ManifestPath for UPM When GooglePlayGames Package location is out of Assets, generate additional files in Asssets --- .../com.google.play.games/Editor/GPGSUtil.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs index 4eadb15a..a5016824 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs @@ -22,6 +22,7 @@ namespace GooglePlayGames.Editor using System.Collections.Generic; using System.IO; using System.Xml; + using System.Linq; using UnityEditor; using UnityEngine; @@ -108,7 +109,7 @@ public static class GPGSUtil /// The Games SDK requires additional metadata in the AndroidManifest.xml /// file. private const string ManifestRelativePath = - "../../Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml"; + "Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml"; private const string RootFolderName = "com.google.play.games"; @@ -187,7 +188,17 @@ private static string GameInfoPath /// file. private static string ManifestPath { - get { return SlashesToPlatformSeparator(Path.Combine(RootPath, ManifestRelativePath)); } + get + { + bool isInAssetsDir = RootPath.Split(Path.DirectorySeparatorChar) + .Contains("Assets"); + + string manifestPath = isInAssetsDir + ? Path.Combine(RootPath, "../../", ManifestRelativePath) + : Path.Combine(Application.dataPath, ManifestRelativePath); + + return SlashesToPlatformSeparator(manifestPath); + } } ///