public static void UpdateMoney(int amount) { DatabaseReference reference = PlayerInformation.GetDatabaseReference() .Child("user") //.Child("pnRD68Js9kU5O4UNvRaPcoueTsy2") .Child(PlayerInformation.auth.CurrentUser.UserId) .Child("money"); reference.GetValueAsync().ContinueWith(task => { if (task.IsCompleted) { // Read DataSnapshot snapshot = task.Result; IDictionary data = (IDictionary)snapshot.Value; string dataMoney = data["money"].ToString(); int tmpMoney = int.Parse(dataMoney); int finalAmount = amount + tmpMoney; PlayerInformation.SoulMoney = finalAmount; // Write SoulMoney soulMoney = new SoulMoney(PlayerInformation.SoulMoney); string json = JsonUtility.ToJson(soulMoney); reference.SetRawJsonValueAsync(json); // Achievement PlayerInformation.AchievementSoul(); } }); }