【发布时间】:2022-09-28 01:54:17
【问题描述】:
我已经在 PlayGames for Android 中实现了身份验证。当用户登录时,他们的用户名会显示在 fireBase 控制台中的“标识符”下。
在 GameCenter 中,它不会:
public void AuthenticateToGameCenter(Action onAuthenticationComplete = null)
{
Social.localUser.Authenticate(success =>
{
Debug.Log(\"Game Center Initialization Complete - Result: \" + success);
if (onAuthenticationComplete != null)
onAuthenticationComplete();
});
}
public Task SignInWithGameCenterAsync()
{
var credentialTask = Firebase.Auth.GameCenterAuthProvider.GetCredentialAsync();
var continueTask = credentialTask.ContinueWithOnMainThread((Task<Credential> task) =>
{
if (!task.IsCompleted)
return null;
if (task.Exception != null)
Debug.Log(\"GC Credential Task - Exception: \" + task.Exception.Message);
var credential = task.Result;
Debug.Log($\"credential { task.Result}\");
var loginTask = auth.SignInWithCredentialAsync(credential);
return loginTask.ContinueWithOnMainThread(handleLoginResult);
});
return continueTask;
}
private void GameCenterLogin()
{
// first initialize, then sign in
var signinAsync = new Action(() => SignInWithGameCenterAsync());
AuthenticateToGameCenter(signinAsync);
}
我错了吗?
标签: c# firebase unity3d firebase-authentication