6.12.0 unity sdk 中是否没有继续操作“ContinueWithOnMainThread”?

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”?

wal*_*eed 6

我的错...

实际上,您必须使用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)

该文档也可用。