Google Play游戏服务| ShowSelectSavedGameUI Unity android

时间:2015-02-06 15:14:12

标签: unity3d google-play-services android-savedstate

我在显示已保存的游戏ui时遇到以下异常。这是我的代码:

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.");
            }
        });

显示UI代码::

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

NotImplementedException:您必须先启用已保存的游戏才能使用它。请参阅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):在GameManager.ShowSelectGame()[0x00000]中:0

然而,每次我从登录获得成功。

1 个答案:

答案 0 :(得分:0)

这个问题通过将其分为两部分得到解决, 在游戏开始时调用Activate platform。 然后致电登录。