Hi guys, I want to get the properties of a room when I'm in lobby. I'm sure that the properties are setted to show on lobby with adding a string to it.
But, at the moment to get this properties instantiating with the RoomInfo class, it seems to be empty.
This is the code I use to create a new room:
if (IF.text.Length > 0 && IF.text.Length <= 20)
{
int PlayerAmount = Int32.Parse(PlayerField.text);
RoomOptions roompos = new RoomOptions()
{
IsVisible = true, IsOpen = true, MaxPlayers = (byte)PlayerAmount
};
roompos.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable();
roompos.CustomRoomProperties.Add("OnlineArray", BehaviourModel.OnlineArray);
roompos.CustomRoomProperties.Add("PlayerLock", ScoreScript.PlayerLock);
roompos.CustomRoomProperties.Add("PlayerDic", WinPanelS.PlayerDic);
if (!PrivacyB.Privacy)
{
if (PI.text.Length > 5)
{
Password = PI.text;
roompos.CustomRoomProperties.Add("Password", Password);
HavePass = true;
}
else
{
A.Play();
}
}
else
{
roompos.CustomRoomProperties.Add("Password", null);
}
string[] Property = new string[] { "Password" };
roompos.CustomRoomPropertiesForLobby = Property;
PhotonNetwork.CreateRoom(IF.text, roompos);
PhotonNetwork.CurrentRoom.SetPropertiesListedInLobby(Property);
And this is the code to get them:
RoomName = T.text;
Has.Add("Password", CreateRoomS.Password);
R = new RoomInfo(RoomName,);
if (R.CustomProperties["Password"] == null)
{
PhotonNetwork.JoinRoom(T.text);
}
else
{
Password = (string)R.CustomProperties["Password"];
Protector.GetComponent().SetBool("Show", true);
LockPanel.GetComponent().SetBool("Show", true);
IsByB = true;
}