如何使用Unity初始化Firebase实时数据库?

时间:2018-10-02 18:47:27

标签: c# visual-studio firebase unity3d firebase-realtime-database

我以前从未使用过Firebase,并且正在尝试将实时数据库连接到我的Unity应用程序。 Firebase说要使用此代码来初始化SDK,但是CheckAndFixDependenciesAsync()出现错误,即“名称空间不能直接包含字段或方法之类的成员”。它还说ContinueWith方法必须具有返回类型,并且在当前上下文中找不到/不存在任务名称空间。

我不确定注释的含义是创建并保存对FirebaseApp的引用。有谁知道我需要做些什么才能使其与Unity一起使用?

Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available) {
// Create and hold a reference to your FirebaseApp, i.e.
//   app = Firebase.FirebaseApp.DefaultInstance;
// where app is a Firebase.FirebaseApp property of your application class.

// Set a flag here indicating that Firebase is ready to use by your
// application.
} else {
UnityEngine.Debug.LogError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
// Firebase Unity SDK is not safe to use here.
}
});

0 个答案:

没有答案