Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Google Saved Games stuck in conflict loop

Discussion in 'Android' started by Asse1, Jul 27, 2016.

  1. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    89
    So we're using the official Google Play Games plugin that can be found here:

    https://github.com/playgameservices/play-games-plugin-for-unity

    But the thing is that we (and also others) have trouble by being stuck in a loop when resolving savegame conflicts. There's already a long thread in their issues but none of the Google developers is answering anymore:

    https://github.com/playgameservices/play-games-plugin-for-unity/issues/1262

    I will explain the problem in a nutshell.

    • We call the manual conflict resolution so we can download the saved game.
    Code (CSharp):
    1. this.playGamesClient.OpenWithManualConflictResolution(
    2.     filename, // always the same since we only have one single progress
    3.     DataSource.ReadNetworkOnly,
    4.     true,
    5.     stateListener.OnSavedGameConflict,
    6.     stateListener.OnSavedGameOpenedForRead);
    • Then the plugin calls our OnSavedGameConflict method. We mainly return the original one.
    Code (CSharp):
    1. public void OnSavedGameConflict(IConflictResolver resolver, ISavedGameMetadata .....)
    2. {
    3.     resolver.ChooseMetadata(original); // On game startup this is always the original
    4. }
    And this OnSavedGameConflict method gets called about every seven seconds and the final OnSavedGameOpenedForRead method never gets called.

    So the following happens inside the C# plugin code.

    • NativeSavedGameClient calls its InternalManualOpen method which calls SnapshotManager.Open
    • This calls the parameter delegate with the Status.SnapshotOpenStatus.VALID_WITH_CONFLICT response
    • A NativeConflictResolver is created which uses the InternalManualOpen method as callback.
    • Now when my OnSavedGameConflict method gets called and inside that method I call resolver.ChooseMetadata(original)
    • The NativeConflictResolver again calls the InternalManualOpen method which then again runs the same procedure as above
    Now I could guess that it's not very clever to always return the original meta but that's exactly what OpenWithAutomaticConflictResolution with the option UseOriginal does so it's totally valid. This method internally calls the InternalManualOpen method. The only difference is, that it sets the prefatchDataOnConflict parameter to false.

    Did anybody run into the same issues and found a solution?
     
    Qbit86 likes this.
  2. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
    I did, and have no solution. Probably, it's better to file issue in the project's bug tracker on GitHub.
     
  3. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    89
    Google is already rolling out a fix for the conflicted files. See last posts from Clay Wilson on the issue page linked in my first post of this thread.