Should custom properties of a room be visible to joining players after the room is created?

I am using Photon for networking in my project. I am creating a room with PhotonNetwork.CreateRoom(). I pass in the room name as well as a set of room options where the room options just specify the number of players as well as a set of CustomRoomProperties. These CustomRoomProperties do not show up for other players when they try to join the room. The CustomRoomProperties hashtable is completely empty even though the room options sent in with the room creation are populated with them. Shouldn't the CustomRoomProperties persist when the room is created so that the values can be used for when others try to join the room? I essentially want to be able to make sure the room that the person is attempting to join has a matching custom room property value.

Answers

  • It turns out that the roomOptions.customRoomPropertiesForLobby property needs to contain the key for the custom property in order for it to be viewed from the lobby. So I just needed to add the line below when creating the RoomOptions and it allowed me to view that property from the other clients' perspective:

    options.customRoomPropertiesForLobby = new string[1] { "myTestKey" };
    

    So my code is as follows in the end:

    var options = new RoomOptions() { MaxPlayers = gameController.MaxPlayers };
    options.customRoomPropertiesForLobby = new string[1] { "myTestKey" };
    options.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable();
    options.CustomRoomProperties.Add("myTestKey", "myTestValue");
    PhotonNetwork.CreateRoom("roomName", roomOptions:options);