how to Update Room Property for lobby?

Options
//inside the lobby scene and lobby script
foreach (var roomInfo in PhotonNetwork.GetRoomList())
        {
            Debug.Log((string)roomInfo.CustomProperties["creator"]);
        }

 //in the game scene and game script
 PhotonNetwork.room.CustomProperties["creator"] = Random.value.ToString();

error resulting into null

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Cariaga,

    Thank you for choosing Photon!

    Set the room's custom properties using:
    PhotonNetwork.room.SetCustomProperties(new Hashtable {{"creator", Random.value.ToString()}});
  • Cariaga
    Cariaga
    edited June 2018
    Options
    i'm still getting null value do i need to place some sort of PunCallback?
    i tested both lobby
    foreach (var roomInfo in PhotonNetwork.GetRoomList())
            {
                Debug.Log((string)roomInfo.CustomProperties["creator"]);
            }
    and game script
    PhotonNetwork.room.SetCustomProperties(new Hashtable {{"creator", Random.value.ToString()}});
    inside update
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    When you create rooms you should make sure "creator" is a custom room property visible from/to the lobby as follows:
    roomOptions.CustomRoomPropertiesForLobby = new string[] {"creator"};
  • Cariaga
    Cariaga
    edited June 2018
    Options
    it works finally thanks alot