Set custom Properties of a room
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Set custom Properties of a room
Paladin83
2018-12-27 18:24:20
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.
Comments
It seems youre doing this on AWAKE. Is this script being fired before youve entered a room/created a room?
Hi @Paladin83,
Thank you for choosing Photon!
You probably want to use PUN1 or PUN Classic code while having PUN2!
Try PhotonNetwork.CurrentRoom.SetCustomProperties(setValue);
More details about changes between PUN1 and PUN2.
Yes I use PUN2. Thank you it works!
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);
Back to top