代码之家  ›  专栏  ›  技术社区  ›  theblitz

谷歌玩不与Unity合作的游戏

  •  1
  • theblitz  · 技术社区  · 7 年前

    我一直有真正的问题,让谷歌游戏的统一插件工作。 在某一点上,它工作得很好。

    突然间,一切都变成了梨形,什么都不起作用。 起初它拒绝保存游戏,现在甚至拒绝登录。

    我尝试卸载该应用程序并清除Play Games缓存和存储,但没有成功。

    我打开了debug,这就是logcat的样子:

        08-06 01:08:52.913 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:08:53.116 26556-26582/il.co.anykey.games.duckgames.duckduckduck W/Unity: !!! [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 WARNING: Creating new PlayGamesPlatform
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:LogWarning(Object)
        GooglePlayGames.OurUtils.<w>c__AnonStorey1:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:68)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.117 26556-26582/il.co.anykey.games.duckgames.duckduckduck W/Unity: *** [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 ERROR: No client available, returning null.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:LogWarning(Object)
        GooglePlayGames.OurUtils.<e>c__AnonStorey2:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:77)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.118 26556-26582/il.co.anykey.games.duckgames.duckduckduck W/Unity: !!! [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 WARNING: PlayGamesPlatform already initialized. Ignoring this call.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:LogWarning(Object)
        GooglePlayGames.OurUtils.<w>c__AnonStorey1:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:68)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.119 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: Activating PlayGamesPlatform.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.120 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.121 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: Creating platform-specific Play Games client.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.122 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: Creating Android IPlayGamesClient Client
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.123 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.124 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: Invoking callbacks, AuthState changed from silentPending to Unauthenticated.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.125 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:53 +03:00 DEBUG: there are pending auth callbacks - starting AuthUI
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:53.398 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:08:54.013 6280-6280/il.co.anykey.apps.floatingvolume D/CatchAppStartsService: onAccessibilityEvent = EventType: TYPE_WINDOW_STATE_CHANGED; EventTime: 25116461; PackageName: com.google.android.play.games; MovementGranularity: 0; Action: 0 [ ClassName: com.google.android.gms.games.ui.signin.SignInActivity; Text: [Google Play Games]; ContentDescription: null; ItemCount: -1; CurrentItemIndex: -1; IsEnabled: true; IsPassword: false; IsChecked: false; IsFullScreen: true; Scrollable: false; BeforeText: null; FromIndex: -1; ToIndex: -1; ScrollX: -1; ScrollY: -1; MaxScrollX: -1; MaxScrollY: -1; AddedCount: -1; RemovedCount: -1; ParcelableData: null ]; recordCount: 0
    08-06 01:08:58.724 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:08:58 +03:00 DEBUG: Application is pausing, which disconnects the RTMP  client.  Leaving room.
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:08:58.949 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:09:00.417 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:09:01.880 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:09:03.604 26556-26556/il.co.anykey.games.duckgames.duckduckduck V/GamesNativeSDK: Play Games callback indicates connection failure.
    08-06 01:09:03.622 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:09:03 +03:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:09:03.625 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:09:03 +03:00 DEBUG: AuthState == Unauthenticated calling auth callbacks with failure
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    08-06 01:09:03.676 26556-26582/il.co.anykey.games.duckgames.duckduckduck I/Unity:  [Play Games Plugin DLL] 08/06/18 1:09:03 +03:00 DEBUG: Invoking user callback on game thread
        UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
        UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
        UnityEngine.Logger:Log(LogType, Object)
        UnityEngine.Debug:Log(Object)
        GooglePlayGames.OurUtils.<d>c__AnonStorey0:<>m__0() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\Logger.cs:59)
        GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at C:\Users\user\Unity Projects\DuckDuckDuck\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:135)
    
        (Filename: C Line: 0)
    

    我有一个单件,它封装了所有玩游戏的调用。

    using GooglePlayGames;
    using GooglePlayGames.BasicApi;
    using GooglePlayGames.BasicApi.SavedGame;
    using System;
    using UnityEngine;
    
    public class GooglePlayGameController {
        [Serializable]
        private class SaveData
        {
            private int level;
            private int score;
    
            public SaveData(int level, int score)
            {
                this.Level = level;
                this.Score = score;
            }
    
            public int Level
            {
                get
                {
                    return level;
                }
    
                set
                {
                    level = value;
                }
            }
    
            public int Score
            {
                get
                {
                    return score;
                }
    
                set
                {
                    score = value;
                }
            }
        }
    
        private static GooglePlayGameController _instance;
    
    
        public static GooglePlayGameController Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new GooglePlayGameController();
    
                return _instance;
            }
        }
    
    
        public GooglePlayGameController()
        {
            PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .EnableSavedGames()
            .Build();
            PlayGamesPlatform.InitializeInstance(config);
    
            // recommended for debugging:
            PlayGamesPlatform.DebugLogEnabled = true;
            GooglePlayGames.PlayGamesPlatform.Activate();
        }
    
        public void AuthenticateGamePlayUser(Action<bool> callback)
        {
            Social.localUser.Authenticate((bool success) =>
            {
                if (success)
                {
                    SavedValues.SetgamePlayLogin(SavedValues.GamePlayLogin.YES);
                }
                else
                {
                    SavedValues.SetgamePlayLogin(SavedValues.GamePlayLogin.NO);
                }
                callback(success);
            });
        }
    
        public void LoadSavedGame(Action<bool, int, int> callback)
        {
            ShowSelectUI((showSelectUiStatus, metadata) =>
            {
                if (showSelectUiStatus == SelectUIStatus.SavedGameSelected)
                {
                    OpenSavedGame(metadata.Filename, (openSavedGameRequestStatus, savedGameMetadata) => {
                        LoadGameData(savedGameMetadata, (loadGameDataRequestStatus, data) =>
                        {
                            if (loadGameDataRequestStatus == SavedGameRequestStatus.Success)
                            {
                                SaveData saveData = (SaveData) Utilities.ByteArrayToObject(data);
                                callback(true, saveData.Level, saveData.Score);
                            }
                        });
                    });
                }
            }); 
            callback(false, 0, 0);
        }
    
        private void ShowSelectUI(Action<SelectUIStatus, ISavedGameMetadata> callback)
        {
            uint maxNumToDisplay = 100;
            bool allowCreateNew = false;
            bool allowDelete = true;
    
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                maxNumToDisplay,
                allowCreateNew,
                allowDelete,
                callback);
        }
    
        private void OpenSavedGame(string filename, Action<SavedGameRequestStatus, ISavedGameMetadata> callback)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                ConflictResolutionStrategy.UseLongestPlaytime, callback);
        }
    
        public void SaveGame(int level, int score, TimeSpan totalPlaytime, Action<SavedGameRequestStatus, ISavedGameMetadata> callback)
        {
            string filename = "Level" + level;
            OpenSavedGame(filename, (requestStatus, gameMetadata) =>
            {
                if (requestStatus == SavedGameRequestStatus.Success)
                {
                    byte[] saveData = Utilities.ObjectToByteArray(new SaveData(level, score));
                    ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
    
                    SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
                    builder = builder
                        .WithUpdatedPlayedTime(totalPlaytime)
                        .WithUpdatedDescription("Level " + level + ". Score: " + score);
    
                    Texture2D savedImage = getScreenshot();
                    if (savedImage != null)
                    {
                        // This assumes that savedImage is an instance of Texture2D
                        // and that you have already called a function equivalent to
                        // getScreenshot() to set savedImage
                        // NOTE: see sample definition of getScreenshot() method below
                        byte[] pngData = savedImage.EncodeToPNG();
                        builder = builder.WithUpdatedPngCoverImage(pngData);
                    }
                    SavedGameMetadataUpdate updatedMetadata = builder.Build();
                    savedGameClient.CommitUpdate(gameMetadata, updatedMetadata, saveData, callback);
                }
                else
                {
    
                    Utilities.Log("SaveGame - Open Failed. Error = " + requestStatus);
                }
            });
        }
    
        private void LoadGameData(ISavedGameMetadata game, Action<SavedGameRequestStatus, byte[]> completedCallback)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ReadBinaryData(game, completedCallback);
        }
    
        private void DeleteGameData(string filename, Action<SavedGameRequestStatus, ISavedGameMetadata> callback)
        {
            // Open the file to get the metadata.
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                ConflictResolutionStrategy.UseLongestPlaytime, callback);
        }
    
        private void DeleteSavedGame(SavedGameRequestStatus status, ISavedGameMetadata game)
        {
            if (status == SavedGameRequestStatus.Success)
            {
                ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
                savedGameClient.Delete(game);
            }
            else
            {
                // handle error
            }
        }
    
    
        public Texture2D getScreenshot()
        {
            // Create a 2D texture that is 1024x700 pixels from which the PNG will be
            // extracted
            Texture2D screenShot = new Texture2D(1024, 700);
    
            // Takes the screenshot from top left hand corner of screen and maps to top
            // left hand corner of screenShot texture
            screenShot.ReadPixels(
                new Rect(0, 0, Screen.width, (Screen.width / 1024) * 700), 0, 0);
            return screenShot;
        }
    
    }
    

    正如我之前所说的,直到昨天,一切都在运转,突然间,一切都消失了。 我有二重、三重和四重(?)检查了设置,一切正常。

    我唯一能想到的最后一步是完全删除插件,然后重新开始,但甚至不能100%确定怎么做。

    1 回复  |  直到 7 年前
        1
  •  0
  •   auslander    7 年前

    检查您可以在谷歌开发控制台中登录到谷歌游戏的电子邮件地址。上传您的apk并从google开发控制台下载。如果是内部测试,请检查您测试客户的电子邮件