Issue with GooglePlayGames package

Hello everyone,

I am trying to save some data in the google play user account by using the GooglePlayGames package (found here).

I can sign in correctly the user with the following code :

    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build();
    PlayGamesPlatform.InitializeInstance(config);
    PlayGamesPlatform.DebugLogEnabled = true;
    PlayGamesPlatform.Activate();

    PlayGamesPlatform.Instance.Authenticate(success =>
    {
      LoadData();
    });

Then the LoadData method is called :

  //used for loading data from the cloud or locally
  void LoadData()
  {
    Debug.Log("LoadData");
    //basically if we're connected to the internet, do everything on the cloud
    if (PlayGamesPlatform.Instance.IsAuthenticated() /*Social.localUser.authenticated*/)
    {
      Debug.Log("authenticated");
      isSaving = false;
      ((PlayGamesPlatform)Social.Active).SavedGame.OpenWithManualConflictResolution(SAVE_NAME,
          DataSource.ReadCacheOrNetwork, true, ResolveConflict, OnSavedGameOpened);
      Debug.Log("OpenWithManualConflictResolution over");
    }
    //this will basically only run in Unity Editor, as on device,
    //localUser will be authenticated even if he's not connected to the internet (if the player is using GPG)
    else
    {
      Debug.Log("not authenticated");
      LoadLocal();
    }
  }

The issue seems to be located here :

((PlayGamesPlatform)Social.Active).SavedGame.OpenWithManualConflictResolution(SAVE_NAME,
              DataSource.ReadCacheOrNetwork, true, ResolveConflict, OnSavedGameOpened);

I get a very ugly error :
“[Exception] : NotImplementedException: You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames.”

This exception is lanched by the code contained in NativeClient.cs from the same package :

if (mConfiguration.EnableSavedGames)
{
    mSavedGameClient =
    new NativeSavedGameClient(new SnapshotManager(mServices));
}
else
{
    mSavedGameClient = new UnsupportedSavedGamesClient("You must enable saved games before it can be used. " + "See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
}

My builder contains the “EnableSavedGames” call, and in the google play console I already activated the saved games in my game service.

I do not know if this problem is related to the fact that I test my code in an internal version, and that I linked the game service to the published game before these modifications (I do not think this works like that, because I can sign in and check the leaderboards …)

If anyone has an idea, It’ll be welcome, I’m stuck on that since a long time now …

It appeared that Google Play Services does not like a lot when we anthenticate twice, and that is what I did …
In parallel of the code I posted in the question, I had a OnEnable method that calls “PlayGamesPlatform.Instance.IsAuthenticated()” to make some checks. At game launch this made the first authentification, and then in the Start method I explicitely authenticate the player. The two combined are catastrophic, so to avoid that I only called the “PlayGamesPlatform.Instance.Authenticate” method to sign in the user, and delete the OnEnable method, everything works fine from now.

for anyone having the same issue after making sure you implemented everything right , this might be your problem :Authentication fails when save games is enabled

and the solution for now is :

that is what worked for me