PhotonNetwork.LeaveRoom C# (CSharp) Method

LeaveRoom() public static method

Leave the current room
public static LeaveRoom ( ) : void
return void
    public static void LeaveRoom()
    {
        if (!offlineMode && connectionStateDetailed != PeerState.Joined)
        {
            Debug.LogError("PhotonNetwork: Error, you cannot leave a room if you're not in a room!(1)");
            return;
        }
        else if (room == null)
        {
            Debug.LogError("PhotonNetwork: Error, you cannot leave a room if you're not in a room!(2)");
            return;
        }

        if (offlineMode)
        {
            offlineMode_inRoom = false;
            NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnLeftRoom);
        }
        else
        {
            networkingPeer.OpLeave();
        }
    }

Usage Example

Ejemplo n.º 1
0
 public void OnClick_LeaveRoom()
 {
     PhotonNetwork.LeaveRoom(true);
     _roomCanvases.CurrentRoom.Hide();
 }
All Usage Examples Of PhotonNetwork::LeaveRoom