[Photon Pun] How to have different types of rooms?

In my game, there’s one scene with 3 different small maps. I made a script to load the player into a room when the player enters these maps, but I don’t want them loading into the same room as the other players in different maps.

TLDR; How can I have it so that the player that goes to map one, doesn’t join the same room as a player in map two?

Edit: I came up with this but it doesn’t work

        RoomOptions options = new RoomOptions();

        options.EmptyRoomTtl = 5000;
        options.IsOpen = true;
        options.IsVisible = true;
        options.MaxPlayers = 10;                          
        
        ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable{ {"m", mapNum} };
        options.CustomRoomProperties = properties;

        PhotonNetwork.JoinRandomOrCreateRoom(expectedCustomRoomProperties: properties,typedLobby: TypedLobby.Default, roomOptions: options, roomName : Random.Range(10000, 99999).ToString());

The players can’t join each other and instead create a room every time.

Figured it out! I needed to set customRoomPropertiesForLobby and now it works.

    void FindOrCreateMatch()
    {
        inQueue = false;
        joinAfterLeaving = false;
        currentMap = roomMap;

        RoomOptions options = new RoomOptions();

        options.EmptyRoomTtl = 5000;
        options.IsOpen = true;
        options.IsVisible = true;
        options.MaxPlayers = 10;                          
       
        options.CustomRoomProperties = properties;
        options.CustomRoomPropertiesForLobby = new string[] {"m"};

        PhotonNetwork.JoinRandomOrCreateRoom(expectedCustomRoomProperties: properties,typedLobby: TypedLobby.Default, roomOptions: options, roomName : Random.Range(10000, 99999).ToString());
    }
1 Like