- Home /
Create Room No overloaded Method Error
CheckPlayerNameAndRoom();
PhotonNetwork.player.name = playerName;
Hashtable setMapName = new Hashtable();
setMapName["MapName"] = allMaps[selectedMap].mapName;
setMapName["RoundDuration"] = roundDuration;
setMapName["GameMode"] = gameMode;
string[] exposedProps = new string[3];
exposedProps[0] = "MapName";
exposedProps[1] = "RoundDuration";
exposedProps[2] = "GameMode";
//Create new Room
PhotonNetwork.CreateRoom(newRoomName, true, true, maxPlayers, setMapName, exposedProps);
Comment
Best Answer
Answer by ChristianSimon · Jan 23, 2017 at 09:25 AM
Hi,
I guess your code is from some outdated tutorial. Here is the way to go. Custom room properties and custom room properties for the lobby are stored as a single RoomOptions object, which you have to use when creating the room. This can look like this:
RoomOptions options = new RoomOptions();
options.CustomRoomProperties = new Hashtable();
options.CustomRoomProperties["MapName"] = "YourMapName";
options.CustomRoomPropertiesForLobby = new string[1];
options.CustomRoomPropertiesForLobby[0] = "MapName";
PhotonNetwork.CreateRoom("YourRoomName", options, null);
Answer by sezbladex · Jan 23, 2017 at 09:59 AM
thanks I write this code it works
Hashtable roomProps = new Hashtable() { { "MapName", allMaps[selectedMap].mapName }, { "RoundDuration", roundDuration },{ "GameMode", gameMode } };
string[] roomPropsInLobby = { "MapName", "RoundDuration" ,"GameMode" };
RoomOptions roomOptions = new RoomOptions();
roomOptions.customRoomProperties = roomProps;
roomOptions.customRoomPropertiesForLobby = roomPropsInLobby;
roomOptions.isVisible = true;
roomOptions.maxPlayers = (byte)maxPlayers;
//Create new Room
PhotonNetwork.CreateRoom(newRoomName,roomOptions,TypedLobby.Default);