I want to do x when FirebaseRef snapshot.Value == null. This works in the Unity Editor everytime but when I do this on the Android device, it fails every time. The app doesn't crash, it just doesn't do anything.
auth is working fine. database is working fine (I'm getting all other values when the values exist) but when the value doesn't exist, that's where I have the issue.
Here is my sudo code, any help would be appreciated.
ref.Child("Location/That/Doesnt/Exist").GetValueAsync().ContinueWithTask(Task => {
if (task.IsFaulted){
//Do something
}
else if (task.IsCompleted){
DataSnapshot snap = task.Result;
if(snap.Value == null){
//This is what hangs. I get here and it just does nothing.
}
}
});
I'm so lost. I'm not sure how to figure this out. I get no errors but it's like the function just stops there.
Thanks all!
EDIT
So what I'm doing to get around this is to create a DB entry in the path with key == "0" and value == 0. Then I say if the ChildCount is greater than 1 and that child has more than 1 child, proceed.
I feel like this is a really poor approach.