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

Can't unsubscribe from events? #1319

Closed
yogev2255 opened this issue Jan 29, 2023 · 3 comments
Closed

Can't unsubscribe from events? #1319

yogev2255 opened this issue Jan 29, 2023 · 3 comments
Labels
new New issue.

Comments

@yogev2255
Copy link

yogev2255 commented Jan 29, 2023

[REQUIRED] Please fill in the following fields:
Unity editor version: 2021.3.15f1
Firebase Unity SDK version: 10.3.0
Source you installed the SDK: .unitypackage __ (.unitypackage or Unity Package Manager)
Problematic Firebase Component: database
(Auth, Database, etc.)
Other Firebase Components in use: non_ (Auth, Database, etc.)
Additional SDKs you are using: GooglePlay_ (Facebook, AdMob, etc.)
Platform you are using the Unity editor on: _windows (Mac, Windows, or Linux)
Platform you are targeting: android (iOS, Android, and/or desktop)
Scripting Runtime: IL2CPP
(Mono, and/or IL2CPP)
[REQUIRED] Please describe the issue here:

Hello,

I use firebase real-time database and I am subscribing to events on start and a few other places and is working fine

but when I am trying to unsubscribe from them
in OnDisable the user still receives updates from firebase why?
I get this on 2 different scripts

I tested with
[ContextMenu("disable")] void RemoveEvents() { db.Child("Users").Child(GameManager.instance.pinCode.ToString()).ChildAdded -= AddPlayerToList; db.Child("Users").Child(GameManager.instance.pinCode.ToString()).ChildRemoved -= RemovePlayerList; db.Child("Servers").Child(GameManager.instance.pinCode.ToString()).ChildChanged -= OnServerChagne; Application.quitting -= UserQuitTheGame; StopAllCoroutines(); Debug.Log("disable lobby"); }
but I still receive events

@yogev2255 yogev2255 added the new New issue. label Jan 29, 2023
@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@jonsimantov
Copy link
Contributor

Hi,

I've managed to reproduce this issue when unsubscribing events from a new DatabaseReference created with the same path as the old DatabaseReference.

As a workaround, if you hold onto the actual DatabaseReference instances that you registered the events on, you should be able to unsubscribe from them.

@yogev2255
Copy link
Author

Thank you, it worked for me

@firebase firebase locked and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new New issue.
Projects
None yet
Development

No branches or pull requests

3 participants