I am integrating Google Firebase in Unity Game Engine using C#.
Here's my code:
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl(databaseUrl);
var firebaseDatabase = FirebaseDatabase.DefaultInstance;
firebaseDatabase.GetReference("SomePath").GetValueAsync().ContinueWith(task =>{
HandleCallback(task.Result.ToDictionary());
});
void HandleCallback(dictionary<string,object> dic)
{
Debug.Log(dic.Keys.Count);
}
I need to somehow pass the result to another method to handle completion. I can't seem to get this to work.
here's no error, the log is just empty.
However if I call the Debug.Log(dic.Keys.Count) inside the Task it works.
Hope to learn and make this work. Thank you.