Hi guys, I have problem with GPGS for few days, I need your help ![]()
async void Awake()
{
try
{
await UnityServices.InitializeAsync();
Debug.Log("initialized");
}
catch (Exception e)
{
Debug.LogException(e);
}
PlayGamesPlatform.Activate();
if (!FB.IsInitialized) FB.Init(InitCallback, OnHideUnity);
else FB.ActivateApp();
if (isClearToken) AuthenticationService.Instance.ClearSessionToken();
if (AuthenticationService.Instance.SessionTokenExists) await SignInCachedUserAsync();
else OnCachedUserNotFound.Invoke();
}
public async void LoginGP() => await LoginWithGPGS();
public async Task LoginWithGPGS()
{
PlayGamesPlatform.Instance.Authenticate(async (code) =>
{
if (code == SignInStatus.Success)
{
string Token = null;
PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
{
tx.text += "\n" +" ********************";
Debug.Log("\n" + "Code:" + code +" --"+ Token + "\n" + "User Name" + Social.localUser.userName + " " + "id:" + Social.localUser.id);
Token = code.ToString();
tx.text += "\n" + "Code:" + code + "\n" + "User Name" + Social.localUser.userName + " " + "id:" + Social.localUser.id;
// SaveTextureToLocalFile(Social.localUser.image, "userpp.png");
});
await SignInWithGooglePlayGamesAsync(Token);
}
else
{
tx.text = code.ToString();
Debug.Log("Login Unsuccessful" + code);
}
});
}
private async Task SignInWithGooglePlayGamesAsync(string authCode)
{
try
{
await AuthenticationService.Instance.SignInWithGooglePlayGamesAsync(authCode);
tx.text += "\"SignIn is successful.";
Debug.Log("SignIn is successful.");
}
catch (AuthenticationException ex)
{
// Compare error code to AuthenticationErrorCodes
// Notify the player with the proper error message
Debug.LogException(ex);
tx.text +=ex;
}
catch (RequestFailedException ex)
{
// Compare error code to CommonErrorCodes
// Notify the player with the proper error message
Debug.LogException(ex);
tx.text += ex;
}
finally
{
OnLoginSuccess.Invoke();
await AfterSignIn();
}
}
Here is my code, when I build apk and run on my Android device I got error like this:
I do everythin right but ı dont understand whats wrong, would you pls help me ? BTW when I open the apk file on my Android device Google Play icon shows up this work correctly.
In LoginWithGPGS function PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
dont work, gives error because this, “code” returns “true” but RequestServerSideAccess function dont work. Can you help me ?





