Can't send CustomRoomProperties information.
I want to be able to display what gametype the lobby is currently playing and the best way to do that seems to be with custom properties.
To start, I want the room state to be 'In Lobby' so in the room creation I create a hashtable containing this information and add it to the RoomOptions like so:
This all works fine, however when I try and get the custom room properties I get nothing (all the other information is received fine).
Thanks,
Wzd.
To start, I want the room state to be 'In Lobby' so in the room creation I create a hashtable containing this information and add it to the RoomOptions like so:
using Hashtable = ExitGames.Client.Photon.Hashtable; // Assign the room settings to a roomOptions object. RoomOptions roomOptions = new RoomOptions { IsVisible = !privateGameToggle.isOn, MaxPlayers = maxPlayers, IsOpen = true, CustomRoomProperties = customRoomProperties }; // Create the room (passing in the rooms name as well as the roomOptions object). PhotonNetwork.CreateRoom(roomNameInputField.text, roomOptions);
This all works fine, however when I try and get the custom room properties I get nothing (all the other information is received fine).
public void Setup (RoomInfo info) { // Game state gameState.text = (string)info.CustomProperties[LOBBY_STATE_KEY]; }
Thanks,
Wzd.
0
Best Answer
-
Hi @Wzd,
Thank you for choosing Photon!
Always remember to read the Matchmaking Checklist for such issues.If you are doing random matchmaking using room properties as a filter make sure to set the keys of those properties to be visible from the lobby when creating the room.
You're missing this:roomOptions.CustomRoomPropertiesForLobby = { LOBBY_STATE_KEY };
5
Answers
-
I made this post yesterday when I was quite tired and now have realised that I didn't include the code for how I made the hashtable. I don't know whether is important, but here it is:
(I create the hashtable just above the RoomOptions object)// Create a hashtable to store the rooms custom properties Hashtable customRoomProperties = new Hashtable(); customRoomProperties.Add(LOBBY_STATE_KEY, "In Lobby");
0 -
Hi @Wzd,
Thank you for choosing Photon!
Always remember to read the Matchmaking Checklist for such issues.If you are doing random matchmaking using room properties as a filter make sure to set the keys of those properties to be visible from the lobby when creating the room.
You're missing this:roomOptions.CustomRoomPropertiesForLobby = { LOBBY_STATE_KEY };
5 -
Hi @Wzd,
Thank you for choosing Photon!
Always remember to read the Matchmaking Checklist for such issues.If you are doing random matchmaking using room properties as a filter make sure to set the keys of those properties to be visible from the lobby when creating the room.
You're missing this:roomOptions.CustomRoomPropertiesForLobby = { LOBBY_STATE_KEY };
Sorry, I must of missed this when searching for an answer before asking this question.
Thank you!
0 -
nvm.0