playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.47k stars 968 forks source link

Issue wrapping the SDK in a custom package (using UPM) #2510

Open Noxalus opened 5 years ago

Noxalus commented 5 years ago

Hello everyone,

I'm trying to create a custom package for the SDK to be used in any project easily using the Unity Package Manager, but I get this error many times:

System.Exception: GooglePlayGames folder was renamed
  at GooglePlayGames.Editor.GPGSUtil.get_RootPath () [0x0003e] in C:\Projects\Plugins-Google\Vendors\GooglePlayServices\GooglePlayServices-0.9.62\Assets\GooglePlayGames\Editor\GPGSUtil.cs:129 
  at GooglePlayGames.Editor.GPGSProjectSettings..ctor () [0x0002c] in C:\Projects\Plugins-Google\Vendors\GooglePlayServices\GooglePlayServices-0.9.62\Assets\GooglePlayGames\Editor\GPGSProjectSettings.cs:57 
  at GooglePlayGames.Editor.GPGSProjectSettings.get_Instance () [0x0000e] in C:\Projects\Plugins-Google\Vendors\GooglePlayServices\GooglePlayServices-0.9.62\Assets\GooglePlayGames\Editor\GPGSProjectSettings.cs:39 
  at GooglePlayGames.Editor.GPGSUpgrader..cctor () [0x00001] in C:\Projects\Plugins-Google\Vendors\GooglePlayServices\GooglePlayServices-0.9.62\Assets\GooglePlayGames\Editor\GPGSUpgrader.cs:35 
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()

Looking at the code, I can see there is a check to find the GooglePlayGames folder directly at the root of the Assets folder, but as I'm in a project that uses this package, this folder is in the package hierarchy, not the project one.

Did somemone already tried to do what I want? Is the UPM is planned to be supported?

Thank you in advance for your answer ;)

gluks commented 4 years ago

I had the same issue. I decided to modify GPGSUtil.cs to change RootPath property according to this doc https://docs.unity3d.com/Manual/upm-assets.html

public static string RootPath
{
    get
    {
        if (string.IsNullOrEmpty(mRootPath))
        {
            mRootPath = "Packages/<package-name>/Runtime/GooglePlayGames";
        }
        return mRootPath;
    }
} 

Obviously, this is not the best solution but it seems to work