Check existence of property

Options
For my game, I have a requirement that I want to check if room has particular property exist or not?
If I directly want to access it then it throws NullReferenceException.

Basically I am accessing property value in following way and based on value I am setting new one.
int wheelPosition = (int)PhotonNetwork.room.customProperties[Constants.PROP_WHEEL_POSITION];
        Debug.Log("Exist wheel position : " + wheelPosition);
        ExitGames.Client.Photon.Hashtable wheelPositionHashTable = new ExitGames.Client.Photon.Hashtable();
        wheelPositionHashTable.Add(Constants.PROP_WHEEL_POSITION, Random.Range(0, 38));
        PhotonNetwork.room.SetCustomProperties(wheelPositionHashTable);

How can I check existence of particular property?

Comments

  • vadim
    Options
    If PhotonNetwork.room.customProperties[Constants.PROP_WHEEL_POSITION] != null then room has the property.
  • Okay and sorry for my this type of question.
    I think some method exist which check for property.