让Google Play游戏使用Unity插件时遇到了真正的问题。 一方面,它运行良好。 可以登录,写入排行榜并保存/获取游戏。
突然,一切都变成了梨形,没有任何效果。 首先,它拒绝保存游戏,而现在甚至拒绝登录。 出现“正在登录”弹出窗口,但随后没有显示从设备中选择所需“用户”或弹出当前用户名称的屏幕。
我尝试卸载该应用,并清除了Play游戏的缓存和存储,但无济于事。
我打开调试,这就是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)
我有一个单例,其中包含对Play游戏的所有调用。 有趣的是,当我创建此代码时,节省游戏的功能停止了。但是现在一切都失败了。
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;
}
}
正如我之前说的,一切工作到昨天为止,突然间一切都死了。 我已经检查了两次,三次和四次(?),设置一切正常。
我唯一能想到的最后一件事就是完全删除该插件,然后重新启动,但即使执行该操作也不能百分百确定。
答案 0 :(得分:0)
在Google开发人员控制台中检查可登录到Google Play的电子邮件地址。上传您的APK并从Google开发人员控制台下载。如果是内部测试,请检查您的客户电子邮件