RoomInfo.CustomRoomProperties is empty on lobby?

Here's how I create the room:

public void CreateRoom(string name, string mode, string map, int maxPlayers) {
popupCreateLobby.SetActive(false);
popupConnecting.SetActive(true);

ExitGames.Client.Photon.Hashtable roomSettings = new ExitGames.Client.Photon.Hashtable() {
{ "name", name }, { "mode", mode }, { "map", map }
};

string[] lobbyProperties = { "name", "mode", "map" };

RoomOptions options = new RoomOptions();
options.IsVisible = true;
options.IsOpen = true;
options.MaxPlayers = (byte) maxPlayers;
options.CustomRoomPropertiesForLobby = lobbyProperties;
options.CustomRoomProperties = roomSettings;
PhotonNetwork.CreateRoom(null, options, TypedLobby.Default);
}
Here's how I display the information. I call this when the game received OnReceivedRoomListUpdate.

public void SetRoomInfo(RoomInfo roomInfo) {
this.roomInfo = roomInfo;

Debug.Log(roomInfo.ToStringFull());

textGameName.text = (string) roomInfo.CustomProperties["name"];
textGameMode.text = (string) roomInfo.CustomProperties["mode"];
textMapName.text = (string) roomInfo.CustomProperties["map"];
textPlayerCount.text = roomInfo.PlayerCount + " / " + roomInfo.MaxPlayers;
}
The log displays:

Room: 'xxxx' visible,open 1/0 players.
customProps: {}
As you can see, the customProps is empty even though I set them properly when I created the room. What gives?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2017
    Hi @AlfonsoMatador,

    Thank you for choosing Photon!

    Are you sure the string values for the lobby properties are not null or empty?
    Did you try random join with lobby properties as a filter? I want to know if this issue is due to room listing inside the lobby (issue with periodic event sent from server to client) or due to the lobby properties not being properly set on server during room creation.
    So this could be a PUN issue or server issue. Since you were the first to report this we need to know more while we try to reproduce on our side.
  • G'day John,

    I know this is pulling up an old topic, but I have just ran into this issue myself.
    I've tried setting custom room options before creating the room and passing the hashtable and i've also tried 'setting' new custom options once the room has been created.

    Neither work...

    Here is a look at my new hash setup;
    PhotonHashTable custProps = new PhotonHashTable();
    custProps.Add("MaxTeamSize", maxTeamSize);

    roomOptions.CustomRoomProperties = custProps;

    maxTeamSize is a byte field

    // Finally Create the Game
    PhotonNetwork.CreateRoom(roomName, roomOptions, TypedLobby.Default);

    Any ideas?

    P.S: Current Photon Server Settings;
    Hosting: Best Region (AU)
    Enabled Regions: Mixed
    Protocol: UDP
  • Hi @Sovaka,

    sorry for the late response.

    There is one part missing in the code snippets you provided, so I want to know if you have set roomOptions.CustomRoomPropertiesForLobby? Setting this tells the server which of the Custom Room Properties are available for clients in the lobby. In your case you need to add roomOptions.CustomRoomPropertiesForLobby = new string[] { "MaxTeamSize" }; in order to make this value available for the lobby clients.

    If you have set CustomRoomPropertiesForLobby but they or their values are still not shown in the lobby, please let us know.
  • Rupert
    Rupert
    edited July 2020
    Hi,

    I can confirm this is happening to me too. I'm trying to set custom properties and display them in the lobby (Master client name in my case)
     string name = LoginManager.instance.facebookName;
                RoomOptions roomOptions = new RoomOptions() { MaxPlayers = maxPlayers, IsOpen = false, IsVisible = true };
                
                Hashtable custProps = new Hashtable();
                custProps.Add("RoomHost", name);
    
                roomOptions.CustomRoomProperties = custProps;
    
                roomOptions.CustomRoomPropertiesForLobby = new string[] { "RoomHost" };
                PhotonNetwork.CreateRoom(roomName, roomOptions, TypedLobby.Default);
    


    And checking the custom properties:
                    Debug.Log(roomInfo.ToStringFull());
    

    Returns:
    Room: 'Table 9776' visible,open 1/10 players.
    customProps: {}

    Any help?
  • jstzwd
    jstzwd
    edited August 2020
    I have the same problem here as Rupert. Any solutions available?
  • jstzwd
    jstzwd
    edited August 2020
    Solved.
  • @jstzwd how did you solve it?
  • @jstzwd Wait, did you just say "solved" without trying to help to others? This is god damn egoistic
  • Okay, I figured it out. Before room host:
    RoomOptions roomOptions = new RoomOptions
    {
          MaxPlayers = maxRoomPlayers,
          // Your properties
    };
    


    First, we have to add ALL parameters to CustomProperties.
    Hashtable customProperties = new Hashtable();
    customProperties.Add("RoomName", roomName);
    customProperties.Add("GameMode", gameMode);
    
    roomOptions.CustomRoomProperties = customProperties;
    

    And THEN we have to CHOOSE which PROPERTIES Photon will show for lobbies.

    We should type property names!
    roomOptions.CustomRoomPropertiesForLobby = new string[] { "RoomName"};
    

    Finally, we can host our room.
    PhotonNetwork.CreateRoom(UniqueRoomID(), roomOptions);
    

    So now other players can get this "RoomName" property from RoomInfo. Like this:
    yourRoomInfo.CustomProperties["RoomName"];
    

    Boom.
  • Glad you found a solution. It sounds as if you didn't find the doc page on properties in matchmaking?