1 year ago
#77507
AARR Learner
Retrieve data in nested for Firebase Realtime Database (Unity C#)
I wanted to retrieve data and link that I put in a nested inside Firebase but I receive an error:
System.Collections.Generic.Dictionary`2[System.String,System.Object][]
I hope there's anyone who can help me solve this issue.
Here is the firebase nested looks like
Here is the code
private IEnumerator LoadCourse_1()
{
//Get the currently logged in user data
var DBTask = DBreference.Child("Course").Child("MDR3005").GetValueAsync();
yield return new WaitUntil(predicate: () => DBTask.IsCompleted);
if (DBTask.Exception != null)
{
Debug.LogWarning(message: $"Failed to register task with {DBTask.Exception}");
}
else if (DBTask.Result.Value == null)
{
//No data exists yet
Course1.text = "-";
Course1CodeName.text = "-";
}
else
{
//Data has been retrieved at dashboard
DataSnapshot snapshot = DBTask.Result;
Course1.text = snapshot.Child("CourseCode").Value.ToString() + ": " + snapshot.Child("CourseName").Value.ToString() ;
//Data retrieve for course data
Course1CodeName.text = snapshot.Child("CourseCode").Value.ToString() + "\n" + snapshot.Child("CourseName").Value.ToString();
TM1.text = snapshot.Child("Notes").Value.ToString();
}
}
c#
unity-game-engine
firebase-realtime-database
0 Answers
Your Answer