我正在我的 Unity 应用程序中实施 Firebase 身份验证。
我在https://github.com/firebase/quickstart-unity/blob/master/auth/testapp/Assets/Firebase/Sample/Auth
这是我的代码:
using Firebase.Auth;
using Firebase;
using Firebase.Extensions;
using UnityEngine;
using System;
public class FirebaseAuthenction : MonoBehaviour
{
public static FirebaseAuthenction fba;
protected DependencyStatus dependencyStatus = DependencyStatus.UnavailableOther;
protected FirebaseAuth auth;
public void Awake()
{
fba = this;
}
public virtual void Start()
{
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available)
{
InitializeFirebase();
}
else
{
Debug.LogError(
"Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
}
protected void InitializeFirebase()
{
auth = FirebaseAuth.GetAuth(FirebaseApp.Create(new AppOptions
{
DatabaseUrl = new Uri("hide"),
ProjectId = "hide",
ApiKey = "hide",
AppId = "hide"
}));
}
public void AuthToken()
{
auth.CreateUserWithEmailAndPasswordAsync("teste", "testp").ContinueWith(task =>
{
if (task.IsCanceled)
{
print("cancled");
return;
}
if (task.IsFaulted)
{
print(task.Exception);
return;
}
FirebaseUser newUser = task.Result;
Debug.LogFormat("User signed in successfully: {0} ({1})",
newUser.DisplayName, newUser.UserId);
});
}
}
我调用
AuthToken
函数并导致以下错误:
flatbuffers::Parser::Parse() failed: (1, 1): error: illegal character: <
UnityEngine.Debug:LogError (object)
Firebase.Platform.FirebaseLogger:LogMessage (Firebase.Platform.PlatformLogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseLogger.cs:95)
Firebase.LogUtil:LogMessage (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:69)
Firebase.LogUtil:LogMessageFromCallback (Firebase.LogLevel,string) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:77)
Firebase.AppUtil:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:4781)
Firebase.Platform.FirebaseAppUtils:PollCallbacks () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseMonoBehaviour.cs:45)
这可能是什么原因造成的,我该如何解决?
更多信息: 统一 2021.3.21f1 火力地堡 SDK 10.6.0 点网 2.1(我没有找到点网 4)