Server Custom Properties
Options
I've (many times) gone over many documents regarding this topic, but they all appear to be outdated. The "Matchmaking guide" which I so often stumble across doesn't even work on its own right with the example code they provide.
After much research, the best I could do in terms of custom room properties was this:
string roomName;
byte maxPlayers;
PhotonNetwork.CreateRoom(roomName, new RoomOptions() {MaxPlayers = maxPlayers}, null);
And that just barely scratches the surface of what I'm trying to do. I need to be able to define map & game mode as a room property and make sure that it's able to be found in the lobby. I've tried a thousand different ways of going about this, but whatever doc I read just simply doesn't work in Unity (My only assumption is an API change occurred).
Any and all help is greatly appreciated! I just need two strings ("Map" and "Gamemode") to be defined, but I can't seem to even do that much.
After much research, the best I could do in terms of custom room properties was this:
string roomName;
byte maxPlayers;
PhotonNetwork.CreateRoom(roomName, new RoomOptions() {MaxPlayers = maxPlayers}, null);
And that just barely scratches the surface of what I'm trying to do. I need to be able to define map & game mode as a room property and make sure that it's able to be found in the lobby. I've tried a thousand different ways of going about this, but whatever doc I read just simply doesn't work in Unity (My only assumption is an API change occurred).
Any and all help is greatly appreciated! I just need two strings ("Map" and "Gamemode") to be defined, but I can't seem to even do that much.
0
Comments
-
RoomOptions newRoomOptions = new RoomOptions(); newRoomOptions.IsOpen = true; newRoomOptions.IsVisible = true; newRoomOptions.MaxPlayers = (byte)maxPlayers; newRoomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable(); newRoomOptions.CustomRoomProperties.Add("map", (string)map); newRoomOptions.CustomRoomProperties.Add("gameMode", (string)gameMode); newRoomOptions.CustomRoomPropertiesForLobby = new String[2]; newRoomOptions.CustomRoomPropertiesForLobby[0] = "map"; newRoomOptions.CustomRoomPropertiesForLobby[1] = "gameMode"; PhotonNetwork.JoinOrCreateRoom((string)roomName, newRoomOptions, null);
1 -
Hi @kriller509,
Thank you for choosing Photon!doesn't even work on its own right with the example code they provide.
Please tell us which code snippet and what error do you get when you try the example so we can fix it for everyone.0