Expected Custom Room properties doesn't appear to be working
Options
I am using the following code to connect or create a random room. For Some reason the JoinRandom never finds the created room if I pass in the expected custom room properties. if i don't pass any expected properties then it does find the room. What am i doing wrong?
PhotonNetwork.CreateRoom(string.Empty, new RoomOptions { CustomRoomProperties = new Hashtable { { "map", "Test" } }, MaxPlayers = 2, PublishUserId = true }, null);And
PhotonNetwork.JoinRandomRoom(new Hashtable { { "map", "Test" } }, 2);
0
Best Answer
-
Hi @Shredder25001,
Thank you for choosing Photon!
Always read the docs and follow tutorials or demos carefully.
Always search the forum before creating new threads.
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.PhotonNetwork.CreateRoom(string.Empty, new RoomOptions { CustomRoomPropertiesForLobby = { "map" }, CustomRoomProperties = new Hashtable { { "map", "Test" } }, MaxPlayers = 2, PublishUserId = true }, null);
5
Answers
-
Hi @Shredder25001,
Thank you for choosing Photon!
Always read the docs and follow tutorials or demos carefully.
Always search the forum before creating new threads.
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.PhotonNetwork.CreateRoom(string.Empty, new RoomOptions { CustomRoomPropertiesForLobby = { "map" }, CustomRoomProperties = new Hashtable { { "map", "Test" } }, MaxPlayers = 2, PublishUserId = true }, null);
5 -
@JohnTube
using PhotonHashTable = ExitGames.Client.Photon.Hashtable; private void FindMatch() { PhotonNetwork.JoinRandomRoom(new PhotonHashTable() { { "map", "Test" } }, 10); } public override void OnJoinRandomFailed(short returnCode, string message) { Debug.Log("OnJoinRandomFailed() -> Creating a new room."); PhotonNetwork.CreateRoom(string.Empty, new RoomOptions { CustomRoomPropertiesForLobby = new string[]{ "map" }, CustomRoomProperties = new PhotonHashTable { { "map", "Test" } }, MaxPlayers = 2, PublishUserId = true }, null); }
this always creates a new room...
EDIT: oh sorry.
expectedMaxPlayers set to 10 where I am creating the room with 2.
always remember to check for typos.1