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.

Get Room properties and Player properties

AlexUnity
2021-03-10 20:35:18

It is impressive that I could not find any single direct example of how to get a room property from a hashtable.
By simply using "customProperties[myHashKeyName]" does not work. All examples from here: https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/pun-basics-tutorial/intro
does not have a single simple "get property this way" example... =/

By example, I mean:

And then when I try to get it via "PhotonNetwork.CurrentRoom.CustomProperties[ROOM_KEY_MapSeed]" it returns null. (and yes, I did it after joining a room, with everything fine running, etc).
I could not find any single example of how to do that, without going to random posts here asking some other room related stuff.

I also tried to use "PhotonNetwork.CurrentRoom.SetCustomProperties(roomData);", but it never returns something on "OnRoomPropertiesUpdate"...

How to do it? Can anyone point me to any direction please?
Thanks.

Comments

AlexUnity
2021-03-10 21:03:16

I found an answer here: https://youtu.be/aVUNiJ3MVSg?t=213

ExitGames team, you should provide some more tutorials and direct answers to important and often called methods that, at first, looks simple, but it can be confusing. I was doing in a different way, it was not returning any errors, only "null" at some point and no clear direction. ANd when I go to your documentation, it says nothing but theory, not direct examples.

Also, many examples here, does not work: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby (maybe outdated from API, etc).

JohnTube
2021-03-10 22:08:20

Hi @AlexUnity,

Thank you for choosing Photon!

Also, many examples here, does not work: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby (maybe outdated from API, etc).

Sorry you ran into this, could you tell us which ones you tried and did not work for you? some snippets are missing interface members implementation to make it shorter.

AlexUnity
2021-03-10 22:14:41

@JohnTube wrote: »

Hi @AlexUnity,

Thank you for choosing Photon!

Also, many examples here, does not work: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby (maybe outdated from API, etc).

Sorry you ran into this, could you tell us which ones you tried and did not work for you? some snippets are missing interface members implementation to make it shorter.

Pretty much the Lobby examples. Some I could fix it while I wanted to test (for example, the Lobby custom property can be changed in a different way, I think it is now array based, can't remember).

matty
2021-03-12 02:38:05

@AlexUnity wrote: »

I found an answer here: https://youtu.be/aVUNiJ3MVSg?t=213

ExitGames team, you should provide some more tutorials and direct answers to important and often called methods that, at first, looks simple, but it can be confusing. I was doing in a different way, it was not returning any errors, only "null" at some point and no clear direction. ANd when I go to your documentation, it says nothing but theory, not direct examples.

Also, many examples here, does not work: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby (maybe outdated from API, etc).

thank you so much i thought i was just doing something stupid, goign to watch this now

matty
2021-03-12 20:16:17

here is my code for anyone else stuch maybe it will help a n00b

Back to top