Search code examples
unity-game-enginegoogle-play-servicesandroid-savedstate

Google Play game services | ShowSelectSavedGameUI Unity android


I am getting following exception on showing saved game ui.Here is my code:

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

        // Activate the Play Games platform. This will make it the default
        // implementation of Social.Active
        PlayGamesPlatform.Activate();

        // Sign in to Google Play Games
        mAuthenticating = true;
        Social.localUser.Authenticate((bool success) => {
            mAuthenticating = false;
            if (success) {
                Debug.Log("Login successful!");
            } else {
                // no need to show error message (error messages are shown automatically
                // by plugin)
                Debug.LogWarning("Failed to sign in with Google Play Games.");
            }
        });

show UI code ::

((PlayGamesPlatform)Social.Active).SavedGame.ShowSelectSavedGameUI("Save game progress",                                                                       1,true,false,SavedGameSelected);

NotImplementedException: You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames. 02-06 20:03:38.804: I/Unity(32369): at GooglePlayGames.Native.UnsupportedSavedGamesClient.ShowSelectSavedGameUI (System.String uiTitle, UInt32 maxDisplayedSavedGames, Boolean showCreateSaveUI, Boolean showDeleteSaveUI, System.Action`2 callback) [0x00000] in :0 02-06 20:03:38.804: I/Unity(32369): at GameManager.ShowSelectGame () [0x00000] in :0

However each time i am getting success from login.


Solution

  • This problem got solved by breaking this into two parts, On game start call Activate platform. And then call for login.