Set custom Properties of a room

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

Gage_IAG
2018-12-28 05:35:43

It seems youre doing this on AWAKE. Is this script being fired before youve entered a room/created a room?

JohnTube
2018-12-28 10:02:04

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.

Paladin83
2018-12-28 10:06:16

Yes I use PUN2. Thank you it works!

Hensi
2021-10-12 17:13:58

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