Hello,
i have a problem with firebase realtime database.
i try to get the Value of a Child named coin as you can see in this code.
The Child Value of coins in the database is 1.
My problem is that sometimes i get back the right value and when i restart my app ist changes to 2 and i don’t know why. So every time i restart it is 1 and sometimes 2.
Sorry for my bad english btw…
public void LoadData()
{
FirebaseDatabase.DefaultInstance
.GetReference("Users").Child(PlayerPrefs.GetString("Username"))
.GetValueAsync().ContinueWith(task =>
{
if (task.IsFaulted)
{
Debug.Log("Error");
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
Debug.Log("coins" + snapshot.Child("coins").Value.ToString());
}
});
Database:
And this is what happen’s: