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

Is it Possible to Show Custom Properties List which are being set in a room?

Sikandar
2020-05-17 23:57:08

Hi,
I am setting Room Custom Room Properties on Runtime and it works in Console when I print them, However I want to show them as soon as they're being created.
Here's my code to set the custom room properties:

Code which Doesn't Work (to show Custom Properties)

This code doens't display properties/values that are being set.

Any help would be appreciated.

Thanks in advance.

Comments

jeanfabre
2020-05-18 06:04:54

Hi,

You can catch custom room and custom player properties change immediately using:

https://doc-api.photonengine.com/en/pun/v2/interface_photon_1_1_realtime_1_1_i_in_room_callbacks.html#ace378cf7df21ab802b2a0d144264e6c5

Bye,

Jean

Sikandar
2020-05-18 09:29:06

Hi Jean,
Thank you for your response.

A small would be great.

Regards.

jeanfabre
2020-05-18 10:20:08

Hi,

Can you rephrase, I am not sure I understand...

Bye

Jean

Sikandar
2020-05-18 20:03:28

Hi Jean,
Sorry my bad. A small example would be great I meant.

Sikandar
2020-05-18 20:54:52

Update
So far I have been able to display custom player properties but these are displayed locally only not sent on server, is there a setting that needs to be changed in order to display one player properties to others?
Here's the code:

Setting Player Properties

Displaying Player Properties

This works locally only, I want others to see this properties on other clients as well.

Thanks in advance.

jeanfabre
2020-05-19 12:28:37

Hi,

you need set player properties using this call:

https://doc-api.photonengine.com/en/pun/v2/class_photon_1_1_realtime_1_1_player.html#a73265fc7665581640574dc7e98526c77

OnClickUpdate needs to be called from the pun callback that will inform you about custom property changes:

https://doc-api.photonengine.com/en/pun/v2/interface_photon_1_1_realtime_1_1_i_in_room_callbacks.html#aabe61c5573a351d1abccb7059d252316

Bye,

Jean

Sikandar
2020-05-19 14:31:28

@Sikandar wrote: »

Update
So far I have been able to display custom player properties but these are displayed locally only not sent on server, is there a setting that needs to be changed in order to display one player properties to others?
Here's the code:

Setting Player Properties

Displaying Player Properties

This works locally only, I want others to see this properties on other clients as well.

Thanks in advance.

Hi Jean,
I am already setting properties with the SetCustomProperties.

Retrieving those properties is an issue which I don't understand how can I get them and show in a text object or console.

Sikandar
2020-05-19 14:33:17

This code also doesn't return anything:

S_Oliver
2020-05-19 18:07:16

HI,
you can read and display every room and player property by using this
Property View
https://github.com/SradnickDev/Photon-Misc/tree/master/Assets/Utilities/Debug/

Its just a debug tool.

I also got something to simplify the work with Room and Player Properties.
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/PropertyHelper.cs

Player Extension
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/PlayerExt.cs
Room Extension
https://github.com/SradnickDev/Photon-Misc/blob/master/Assets/Utilities/RoomExt.cs

jeanfabre
2020-05-20 06:13:54

@Sikandar wrote: »

This code also doesn't return anything:

This function is not supposed to return anything, you use that function to be made aware that changedProps set of values were changed, it's a callback. implement that callback in your pun mono behavior and it will be called everytime a property changed.

don't overthink this, it's straight forward :)

Bye,

Jean

Back to top