PUN Trying to join room based on CustomRoomProperties [Solved]

Options
Uzair
Uzair
Hi,
I'm trying to add a value to CustomRoomProperties while creating a room and use that value as a filter while other clients are trying to join a room but it doesn't seem to work.

Here is part where i am creating the room.

RoomOptions roomOptions = new RoomOptions()
{
MaxPlayers = maxPlayers,
PublishUserId = true,
CustomRoomProperties = new Hashtable() { { "BetValue", PlayerPrefs.GetInt("CurrentBetVlaue", 100) } },
};
PhotonNetwork.CreateRoom(null, roomOptions , null );



Here is where I am trying to join.
PhotonNetwork.JoinRandomRoom(new Hashtable() { {"BetValue",PlayerPrefs.GetInt("CurrentBetVlaue", 100) } }, maxPlayers);


The created room has the CustomRoomProperties what i have set but the clients that are trying to join the room, when they access this room's CustomProperties, they find a null value. Somehow the properties are not available to the clients who are accessing this value from the lobby.

Any help would be great.

Comments

  • Uzair
    Options
    Hi,

    I found the solution by reading the documentation clearly once again.
    It seems that by default, not all of the CustomRoomProperties are visible to all the users. In order to make a property available to users in the lobby, you have to add it to the CustomRoomPropertiesForLobby.

    Simply added this like "CustomRoomPropertiesForLobby = new string[] {"BetValue"}," to the roomOptions body.