PUN 2 - Get Custom Properties Of Players

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.

PUN 2 - Get Custom Properties Of Players

omard2000
2018-12-25 17:33:59

Hi everyone,

I tried looking for documentation to find my solution to this but have had no luck. I am trying to access each player's custom properties to check their team.

this is what I want: PhotonNetwork.Player.GetCustomProperties["Team"].ToString();

How can I do this in PUN2?

Thank you!

Comments

JohnTube
2018-12-25 20:30:12

Hi @omard2000,

Thank you for choosing Photon!

You can get the list of players using PhotonNetwork.PlayerList.
For each player (element of that array), you can get the custom properties using Player.CustomProperties.

for(int i=0; i

omard2000
2018-12-26 00:58:03

@JohnTube Thank you! :smiley:

Back to top