Open frankvHoof93 opened 2 years ago
I spotted a second bug:
The ManifestRelativePath
in the same script is relative to the Package Root Directory.
However: The package isn't necessarily part of the project folder structure, whereas the AndroidManifest.xml should be in the Assets-folder.
Thus; this Path should be made relative to the Assets-folder or the Project-Folder, not the Package-Folder.
I managed to resolve this by changing the ManifestRelativePath to:
private const string ManifestRelativePath = "Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml";
As well as updating ManifestPath to:
private static string ManifestPath
{
get { return SlashesToPlatformSeparator(Path.Combine("Assets", ManifestRelativePath)); }
}
I am using version 0.11.1 installing it from our private upm repository and can confirm I have the same issue described here.
I applied both fixes and it's working. As @frankvHoof93 described, the fact that packages downloaded from upm are in /Library/PackageCache instead of /Assets/Packages is what's causing the problem.
It appears that there was some change in Unity between Unity 2018.4 and Unity 2021.3 that's causing the following line in GPGSUtil.cs to not return any results (this is at the top of the Getter for RootPath):
string[] dirs = Directory.GetDirectories("Packages", RootFolderName, SearchOption.AllDirectories);
whereRootFolderName = com.google.play.games
This works fine and returns the proper folder in Unity 2018, but returns nothing in Unity 2021, causing the import of the Package to fail (when imported as a Package via the manifest.json).Calling
Path.GetFullPath($"Packages/{RootFolderName}")
actually DOES resolve to a proper path. Thus, this bug can be resolved by the following code:Which will add a 'working' path to the Array and cause the import to succeed. Of course this isn't the cleanest way to resolve it. However: It does show that newer Unity-Versions require the usage of
Path
(or potentiallyAssetDatabase
?) to search for the package-directory.Additional Details:
The Package is added as a Local Package (via Package Manager->Add from disk->manifest.json) for both versions of Unity.
Here's the code I added to GPGSUtil.cs -> RootPath to check this issue:
When this runs in Unity 2018.4.36f1 I get the following result:
In Unity 2021.3.2f1 the same code results in: And not manually adding the (proper) Path results in the Plugin error that's at the top of the switch-statement. Along with the following Console-Output: