0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Unity]FirebaseでDatabaseReferenceの存在を確認する

Last updated at Posted at 2017-03-17

UniRx使用

IObservable<bool> ExistsAsync (DatabaseReference reference)
{
	var subject = new AsyncSubject<bool> ();
	reference.GetValueAsync ().ContinueWith (x => {
		if (x.IsFaulted) {
			Debug.LogError ("Fail to read guildInfo");
			// エラーを飛ばす
			subject.Dispose ();
		} else if (x.IsCompleted) {
			DataSnapshot snapshot = x.Result;
			subject.OnNext (snapshot.Exists);
			subject.OnCompleted ();
		}
	});
	return subject;
}

取得には早くても0.2秒,遅いと1.4秒ほどかかった.

再生直後だと,1秒近くかかりましたが,基本的に0.2秒ほどでした.

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?