From my Unity app, I can create accounts and sign in to them but I can't write or read a data from firebase.
For example, this line gives me error "null reference exception"
var DBTask = DBreference.Child("users").Child(User.UserId).Child("username").SetValueAsync(_username);
So I tried to find where the problem is, and I tried to print a message after database reference, but Unity never prints the message. Am I doing something wrong when creating DBreference?
void Awake()
{
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available)
{
InitializeFirebase();
}
else
{
}
});
}
private void InitializeFirebase()
{
auth = FirebaseAuth.DefaultInstance;
DBreference = FirebaseDatabase.DefaultInstance.RootReference;
Debug.Log("Done!");
}