wal*_*eed 2 c# unity-game-engine google-cloud-firestore
我在 Unity 上使用 firestore 最新的 sdk“6.12.0”。我必须从数据库获取数据并将其保存到 PlayerPrefs,但由于 PlayerPrefs 仅在主线程上运行,因此会导致旧的“ContinueWith”继续操作出现错误。
Firebase 在文档中给出了这个“ContinueWithOnMainThread”,但我无法在 API 上找到它。我只得到“ContinueWith”选项。
问题是什么,6.12.0 中是否存在“ContinueWithOnMainThread”?
我的错...
实际上,您必须使用Firebase.Extensions API 来获取“ContinueWithOnMainThread”函数:
using Firebase.Extensions;
void Start(){
Firebase.FirebaseApp.CheckAndFixDependenciesAsync()
.ContinueWithOnMainThread(fixTask=>{
Debug.Log("we are in main thread");
})
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3715 次 |
| 最近记录: |