i really don’t know what i am doing wrong, i made another class names User and stored a string called username in it, and then on another script put this code, so i can save database in firebase, it says that the line (DBreference.Child…) is the line that is causing the error and it is object reference not set to an instance
public void SaveData()
{
User user = new User();
user.Username = usernameRegisterField.text;
string json = JsonUtility.ToJson(user);
DBreference.Child("User").Child(user.Username).SetRawJsonValueAsync(json).ContinueWith(task =>
{
if (task.IsCompleted)
{
Debug.Log("successfully added data");
}
else
{
Debug.Log("not successfull");
}
});
}