play-games-plugin-for-unity
play-games-plugin-for-unity copied to clipboard
PlayGamesPlatform.Instance.SavedGame is null when using Social.localUser.Authenticate GPGS 0.11.01
Describe the bug PlayGamesPlatform.Instance.SavedGame is null when using Social.localUser.Authenticate instead of PlayGamesPlatform.Instance.Authenticate to authenticate. This was not a problem in v. 0.10.14.
To Reproduce Steps to reproduce the behavior:
- Use GPGS 0.11.01
- Authenticate with Social.localUser.Authenticate like below
- In the callback for Authenticate, try to use PlayGamesPlatform.Instance.SavedGame after success
- An exception is thrown because SavedGame is null
- Try the same with PlayGamesPlatform.Instance.Authenticate instead and everything is ok
Successfully authenticates but SavedGame is null:
Social.localUser.Authenticate(
(bool success) =>
{
if (success)
{
Log("Successfully authenticated");
LoadCoins(DataManager.Instance.GetTotalValue()); //Crashes when using PlayGamesPlatform.Instance.SavedGame
}
[...]
});
Working code:
var callback = new Action<SignInStatus>((signinStatus) =>
{
switch (signinStatus)
{
case SignInStatus.Success:
Log("Successfully authenticated");
LoadCoins(DataManager.Instance.GetTotalValue());
break;
[...]
}
});
PlayGamesPlatform.Instance.Authenticate(callback);
Expected behavior I would expect the two methods for authenticating to both be working.
Observed behavior Social.localUser.Authenticate does not work to get saved games. Some logs from the process:
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript: Successfully authenticated
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:<SignIn>b__17_0(Boolean)
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:SignIn()
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:Start()
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript: Saved Game: Reading
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:LoadCoins(Int32)
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:<SignIn>b__17_0(Boolean)
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:SignIn()
08-24 22:32:54.729 6578 6627 I Unity : GooglePlayGamesScript:Start()
08-24 22:32:54.740 6578 6627 I Unity : GooglePlayGamesScript: Failed to read saved game: PlayGamesPlatform.Instance.SavedGame is null!
Bug Report Private dump: https://drive.google.com/file/d/1-NZcXj-CQt575IDLDaSyynORy_eJ-kDc/view?usp=sharing
Versions
- Unity version: 2022.3.7f1
- Google Play Games Plugin for Unity version: 0.11.01
Additional context I guess the problem is not that critical since there's a workaround.
Please tell if someone got this working!
EDIT: Social.ShowAchievementsUI() also stopped working while PlayGamesPlatform.Instance.ShowAchievementsUI() still works.
EDIT 2: Might be caused by the same problem as in #3261