Join Or Create Room() photon

Code Example - Join Or Create Room() photon

                
                        using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class JoinToMainRoom : MonoBehaviourPunCallbacks
{
    public void CreateOrJoinRoom()
    {
        RoomOptions roomOptions = new RoomOptions();
        roomOptions.IsVisible = true;
        roomOptions.MaxPlayers = 20;
        PhotonNetwork.JoinOrCreateRoom("Game", roomOptions, TypedLobby.Default);
    }
}
                    
                
 

Photon Join Room

                        
                                // Join room "someRoom"
PhotonNetwork.JoinRoom("someRoom");
//Fails if "someRoom" is not existing, closed or full. Error callback: IMatchmakingCallbacks.OnJoinRoomFailed
                            
                        
 

Related code examples