I have been having real problems getting the Unity plugin for Google Play Games to work. At one point it was working great. Could login, write to leaderboard and save/fetch games.
Suddenly it all went pear shaped and nothing works. First it refused to saves games and now it refuses even to login. The "logging in" popup appears but it doesn't then give the screen to choose the "user" you wish from your device or pop up the name of the current user.
I tried uninstalling the app and clearing the Play Games cache and storage to no avail.
I turned on debug and this is what the logcat looks like:
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)
I have a singleton that encapsulates all the calls to Play Games. Funnily enough, it was when I created this that the game-saving stopped working. But now all has failed.
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;
}
}
As I said before, everything worked until yesterday and suddenly it all died. I have double, triple and quadruple (?) checked the settings and everything is okay.
The only final act I can think of is to totally remove the plugin and start again but not 100% sure even how to do that.
SIGN_IN status: ERROR_NOT_AUTHORIZED
. I think the email you use to test doesn't exist in the test emails on your google play dev console. You should also double check if the allow testing button on the dev console not reset back to red – Visal ChhourmSaved Games
option on the game details section like this one ibb.co/jpcAmK – Visal Chhourm