Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observer won't detect Change #295

Open
RPGFabi opened this issue Aug 31, 2022 · 1 comment
Open

Observer won't detect Change #295

RPGFabi opened this issue Aug 31, 2022 · 1 comment

Comments

@RPGFabi
Copy link

RPGFabi commented Aug 31, 2022

Currently I try an Observer to get me updates from my DB, which looks like this:

root
---schoolData
------name
------etc.

I have an Class, which defines the Schooldata and I can read and store it.

When I try to add an Observer with this code

    void Test(){
        var observable = firebase.Child("schoolData").AsObservable<SchoolData>().Subscribe(data => Test2(data));
        Debug.Log("Created");
    }

    private void Test2(FirebaseEvent<SchoolData> obj)
    {
        Debug.Log(obj.Object);
    }`

I get an message, that it is created, but when I change an child's value or add an child, the Test2 function wont trigger.

What am I doing wrong?

Edit: Capturing and printing an exception in AsObservable() shows, states this:

Exception occured while processing the request.
Url: databaseurl/schoolData/.json
Request Data:
Response: data: {correct Data}
UnityEngine.Debug:Log (object)
Firebase.Firebasehandler:Test3 (object,Firebase.Database.ContinueExceptionEventArgs1<Firebase.Database.FirebaseException>) (at Assets/Scripts/Firebase/Firebasehandler.cs:277) Firebase.Database.Streaming.FirebaseSubscription1<School.SchoolData>:OnExceptionThrown (Firebase.Database.FirebaseException,bool)
Firebase.Database.Streaming.FirebaseSubscription`1/d__14<School.SchoolData>:MoveNext ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

So it reads the correct data and detects the change in data true having 2 different data requested but it wont call the Action i passed as an argument.

Even listening to an specific child (name) doesnt register an change

@RPGFabi RPGFabi changed the title Can't create Observer Observer won't detect Change Sep 1, 2022
@TomasGranda
Copy link

have you fix this problem? i have the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants