Room only for players of a certain level
Options
How can I create a room only for players of a certain level of experience that is transmitted from my backend? Thank you in advance!
0
Comments
-
Set required level of experience in room properties.0
-
@OneManArmy , thanks for the answer, but after a successful creating room I call the next method with Hashtables and see "NullReferenceException" in "PhotonNetwork.CurrentRoom" line:
// room creator part public void AddLevelBounds() { requiredLevel = playerLevel; ExitGames.Client.Photon.Hashtable prop = new ExitGames.Client.Photon.Hashtable(); prop.Add((object)requiredLevel, (object)playerLevel); PhotonNetwork.CurrentRoom.SetCustomProperties(prop); // "NullReferenceException" error } // guests part public override void OnJoinedRoom() { enterLevel = (int) PhotonNetwork.CurrentRoom.PropertiesListedInLobby.GetValue(requiredLevel); if (playerLevel < (enterLevel - deltaLevel) || playerLevel > (enterLevel + deltaLevel)) { PhotonNetwork.JoinRandomRoom(); } }
// also try another way (with same error): PhotonNetwork.CurrentRoom.CustomProperties.Add(prop, playerLevel);
0