Hello guys,
I have a problem. Even though I tried many times, I could not solve this problem. Below I share my project settings and codes with you. Thank you in advance to those who will help.
Unity version 2022.3.12f
Scripting : .NET Standart 2.1
private void Start()
{
try
{
PlayGamesPlatform.Activate();
PlayLoginn();
}
catch (Exception e)
{
infoTxt.text = "Try error: " + e.ToString();
throw;
}
}
public void PlayLoginn()
{
PlayGamesPlatform.Instance.Authenticate((success) =>
{
if (success == SignInStatus.Success)
{
infoTxt.text = "Login In.";
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{
if (task.Result == Firebase.DependencyStatus.Available)
{
firebaseTxt.text = "Dependency in";
connectToFirebase();
}
else
{
firebaseTxt.text = "Dependency Error";
}
});
}
else if (success == SignInStatus.InternalError)
{
infoTxt.text = "InternalError: " + success.ToString();
}
else
{
infoTxt.text = "Error: " + success.ToString();
}
});
}
void connectToFirebase()
{
PlayGamesPlatform.Instance.RequestServerSideAccess(true, code =>
{
try
{
authCode = code;
FirebaseAuth fbAuth = FirebaseAuth.DefaultInstance;
Credential fbCred = PlayGamesAuthProvider.GetCredential(authCode);
fbAuth.SignInWithCredentialAsync(fbCred).ContinueWithOnMainThread(task =>
{
if (task.IsCanceled)
{
firebaseTxt.text = "Sign in cancelled";
}
if (task.IsFaulted)
{
firebaseTxt.text = "fireBase Error: " + task.Result;
}
Firebase.Auth.FirebaseUser user = fbAuth.CurrentUser;
if (user != null)
{
firebaseTxt.text = "Signed in as: " + user.DisplayName;
}
});
}
catch (Exception e)
{
throw;
}
});
}