4

In my project I've got quite a nice amount of listeners set to listen for any changes in the realtime database. For some reason those listeners stay even if I reload the scene using

Application.LoadLevel("mainScene");

It would be quite a lot of hassle to remove each listener individually using

FirebaseDatabase.DefaultInstance
    .RootReference
    .Child("sub path 1")
    .Child("sub path 2")
    .ValueChanged -= SomeFunction;

FirebaseDatabase.DefaultInstance
    .RootReference
    .Child("path")
    .ValueChanged -= AnotherFunction;

Is there a way to remove listeners from all paths?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jonathan
  • 325
  • 2
  • 3
  • 24

1 Answers1

0

On most platforms the Firebase SDK has a call to remove all handlers from a location. But from a quick scan such a method doesn't seem to be available in the Unity SDK. If might be worth filing a feature request.

Note that even if such a method exists in C#, you'll still need to call it on each DatabaseReference your code uses.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807