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! Your search result can be found below. Plus, we offer support via these channels:

Try Our

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.

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.

Custom room properties update question

2020-12-16 23:36:20

Hello, currently I'm setting up a menu where game options such as frags, time limit can be set to the custom room properties. Since different game modes such as DM and CTF will have a different number of options, the custom room options will differ in size when switching between modes. e.g. DM room options [frags=10,time=10], CTF room options [points=10,time=10]. What I'll do on the master side when changing game modes is clear the room options then get the all the new modes options and add them to the room options before using SetCustomProperties(). This works on the master, but on the client it seems any differences are only updated and/or added to their room options e.g. when switching from DM to CTF: Master [frags=10,time=10], client(s) [frags=10,time=10,points=10], ideally the client should match the master. Is there an option to replace client room options rather than update or do I have to make my own system that updates the clients room options manually once an update is detected?


2020-12-17 00:10:19

why don't you have a Multiplayer_GameManager in the scene that checks for: OnPlayerPropertiesUpdate
it would look something like:

This way, all you have to do is update the master clients customProperties and everyone in the rooms will update to the same

2020-12-17 00:29:06

Aren't player properties different from room properties? I want all players to get the same game option updates, so changing the room property seemed like the ideal solution. Will the set custom player properties method not do the same thing as set custom room properties in that it only updates/adds what's already set?

2020-12-17 01:07:42

ahh i see whatcha mean there, was a little mistaken.

should be something like this than:

2020-12-17 01:40:05

Yeah, I've already done this, what I'm saying is that it seems only new items or changes are updated to the clients room properties. For example the current mode is Deathmatch so the hashtable would look like this: [frag=10,time=10], I(as the master, clients cannot change game mode options) change the mode to CTF the room properties will gather all the default CTF options(I've implemented this logic already) and SetCustomProperties with a new hashtable that looks like this [point=10,time=10]. Side note: On the master client, I made it so when a mode change occurs, the previous room properties are basically cleared removing all items, before adding anything new. The room properties on the master look fine [point=10,time=10], but the clients end up as [frag=10,point=10,time=10], frag should not be there. So my question is, is there some way to have room property update functionality overwrite client room properties or do I have do some kind of out of the way work around?

2020-12-17 02:10:27

hmm try resetting the properties to the roomOptions and then broadcasting them

Back to top