0

I need to retrieve a value stored in my firebase Realtime DB. It works well so far but i have found a bug that when you are on one device (mobile) change the value in the DB and then you go back to pc and read the same value in the same place, the return is different than what i can see on the DB.

Here is the retrieving code

var DBTask = await m_DBReference.Child("users").Child(m_User.UserId).Child("EnergyData").Child("CurrentEnergy").GetValueAsync();

    if (DBTask.Value == null)
    {
        //no data contained
        energyData.iEnergy = 20;//Default starting value
    }
    else
    {
        energyData.iEnergy = int.Parse(DBTask.Value.ToString());
        print("Direct DB energy = " + energyData.iEnergy);
    }

I am noticing this only happens when changing the value in the DB in one device (i am able to see the change happened in the firebase console), then whn trying to get the same value from the same place in the DB, i get a different one, weird thing is that it doesnt happen always.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

1

https://github.com/firebase/quickstart-unity/issues/913

this was my problem and solution