RemoveListener() public method

public RemoveListener ( RoomManagerListener oldListener ) : void
oldListener RoomManagerListener
return void
        protected override void OnDestroy()
        {
            if (sharingStage.SessionsTracker != null)
            {
                sharingStage.SessionsTracker.CurrentUserJoined -= CurrentUserJoinedSession;
                sharingStage.SessionsTracker.CurrentUserLeft   -= CurrentUserLeftSession;
            }

            if (roomManagerCallbacks != null)
            {
                roomManagerCallbacks.AnchorsDownloadedEvent -= RoomManagerCallbacks_AnchorsDownloaded;
                roomManagerCallbacks.AnchorUploadedEvent    -= RoomManagerCallbacks_AnchorUploaded;

                if (roomManager != null)
                {
                    roomManager.RemoveListener(roomManagerCallbacks);
                }

                roomManagerCallbacks.Dispose();
                roomManagerCallbacks = null;
            }

            if (roomManager != null)
            {
                roomManager.Dispose();
                roomManager = null;
            }

            base.OnDestroy();
        }
    void OnDestroy()
    {
        base.OnDestroy();

        if (roomManagerCallbacks != null)
        {
            roomManagerCallbacks.AnchorsDownloadedEvent -= RoomManagerCallbacks_AnchorsDownloaded;
            roomManagerCallbacks.AnchorUploadedEvent    -= RoomManagerCallbacks_AnchorUploaded;

            if (roomManager != null)
            {
                roomManager.RemoveListener(roomManagerCallbacks);
            }
        }
    }