Extract database from firebase in json to struct
thats my struct
[System.Serializable]
public struct TargetData
{
public string title;
public string human;
public string description;
public TargetData(string Title, string Human, string Description)
{
this.title = Title;
this.human = Human;
this.description = Description;
}
public override string ToString()
{
return title;
}
}
thats how i get json from firebase(hope i do this correct)
public List<TargetData> extractedValues;
private void Start()
{
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://artesktask.firebaseio.com/");
LoadDataFromFireBase();
}
public void LoadDataFromFireBase()
{
FirebaseDatabase.DefaultInstance.GetReference("List").
GetValueAsync().
ContinueWith(task =>
{ if (task.IsFaulted)
{
Debug.LogWarning("NoDatabase");
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
Debug.Log(snapshot.Child("0").ToString());
}
});
//here i have to populate data from FB in list
CompareData(extractedValues);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612221204im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do delete the lowest value on my list? 0 Answers
Storing levels data 1 Answer
Whats the best option for an item database for a single player game 2 Answers
What should I use, a Dictionary with 100 entries or a class with 100 variables? 0 Answers
How to load different content from database when select different option? 0 Answers