Set via Room.SetCustomProperties (not available for RoomInfo class!)
Options
I wanna display the customProperty in the Lobby
When I wanna display them I try this but it is always empty
the docz says
Well, so it is impossible to display custom Properties in the Lobby? because that field is not available in RoomInfo.class ?
ExitGames.Client.Photon.Hashtable table = new ExitGames.Client.Photon.Hashtable();
table.Add("mode", "test");
if (PhotonNetwork.CreateRoom(RoomName.text, roomOptions, TypedLobby.Default))
{
print("create room successfully sent.");
}
else
{
print("create room failed to send");
}
table.Add("mode", "test");
if (PhotonNetwork.CreateRoom(RoomName.text, roomOptions, TypedLobby.Default))
{
print("create room successfully sent.");
}
else
{
print("create room failed to send");
}
When I wanna display them I try this but it is always empty
RoomInfo[] roomInfos = PhotonNetwork.GetRoomList(); foreach (RoomInfo roomInfo in roomInfos) { Debug.Log("CP: " + (string) roomInfo.CustomProperties["mode"] ); RoomReceived(roomInfo); }
the docz says
/// <summary>Read-only "cache" of custom properties of a room. Set via Room.SetCustomProperties (not available for RoomInfo class!).</summary> /// <remarks>All keys are string-typed and the values depend on the game/application.</remarks> /// <see cref="Room.SetCustomProperties"/> public Hashtable CustomProperties { get { return this.customPropertiesField; } }
Well, so it is impossible to display custom Properties in the Lobby? because that field is not available in RoomInfo.class ?
0
Comments
-
Hi @kk88,
to make Custom Room Properties available for the lobby, you have to set those entries by using the RoomOptions before creating the room. An example for this can be found in the Matchmaking guide in the section 'Room Properties and the Lobby'.
From the above mentioned doc page:RoomOptions roomOptions = new RoomOptions(); roomOptions.CustomRoomPropertiesForLobby = { "map", "ai" }; roomOptions.CustomRoomProperties = new Hashtable() { { "map", 1 } }; PhotonNetwork.CreateRoom(roomName, roomOptions, typedLobby);
0