Commit 45c376cd authored by Thierry's avatar Thierry
Browse files

Fix bugs where event handlers did not properly unregister themselves...

parent a30cd347
...@@ -19,6 +19,10 @@ public class HealthBarHUD : MonoBehaviour { ...@@ -19,6 +19,10 @@ public class HealthBarHUD : MonoBehaviour {
PlayerHealthUpdateEvent.handler += OnPlayerHealthUpdate; PlayerHealthUpdateEvent.handler += OnPlayerHealthUpdate;
} }
void OnDestroy () {
PlayerHealthUpdateEvent.handler -= OnPlayerHealthUpdate;
}
private void OnPlayerHealthUpdate (PlayerHealthUpdateEvent e) { private void OnPlayerHealthUpdate (PlayerHealthUpdateEvent e) {
if (!e.Victim.Identity.hasAuthority) if (!e.Victim.Identity.hasAuthority)
return; return;
......
...@@ -66,6 +66,8 @@ public class LobbyUIManager : MonoBehaviour { ...@@ -66,6 +66,8 @@ public class LobbyUIManager : MonoBehaviour {
} }
void OnDestroy () { void OnDestroy () {
LobbyMngr.onConnected -= OnConnected;
LobbyMngr.onDisconnected -= OnDisconnected;
PlayerConnectedEvent.handler -= OnPlayerConnectedEvent; PlayerConnectedEvent.handler -= OnPlayerConnectedEvent;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment