private void OnDestroy() { JoinButton.onClick.RemoveAllListeners(); HostButton.onClick.RemoveAllListeners(); CloseButton.onClick.RemoveAllListeners(); HostPanel.GameRegistered -= OnHostedGameRegistered; HostPanel.Canceled -= OnHostingCanceled; JoinPanel.GameJoined -= OnGameJoined; JoinPanel.Canceled -= OnJoinCanceled; HostPanel = null; JoinPanel = null; }