Set custom Properties of a room

Hallo. Merry christmas to all :)
I want to set a room propertie with the code:
void Awake()
        {
            Hashtable setValue = new Hashtable();
            setValue.Add("val", turn);
            PhotonNetwork.room.SetCustomProperties(setValue);
}
But unfortunately the error occurs: " PhotonNetwork does not contain a definition for ´room´ "

Thanks for any help guys.

Best Answer

Answers

  • It seems youre doing this on AWAKE. Is this script being fired before youve entered a room/created a room?
  • Yes I use PUN2. Thank you it works!
  • Hensi
    Hensi
    edited October 2021

    If anyone still got this problem, this worked for me:

            ExitGames.Client.Photon.Hashtable setValue = new ExitGames.Client.Photon.Hashtable();
            setValue.Add("value", 1);
            PhotonNetwork.CurrentRoom.SetCustomProperties(setValue);