private void Start() { Path.GetReferenceFromRoot(Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference) .ChildAdded += OnChildAdded; Task.Run(() => { var task = Path.GetReferenceFromRoot(Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference) .GetValueAsync(); var result = task.Result; if (result.HasChildren) { foreach (var child in result.Children) { // HandleChildAdded(child); } } else { //경로에 데이터 자식들이 없음 Debug.Log("Does not have children"); } }); }
public Task Push(object item) { if (Firebase.Auth.FirebaseAuth.DefaultInstance.CurrentUser != null) { //Do not commit it if the user is not logged in 유저가 로그인하지않으면 접근 못함 return(Path.GetReferenceFromRoot(Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference) .Push() .SetRawJsonValueAsync(JsonUtility.ToJson(item))); } return(Task.FromResult(new Object())); }