How i get my UserId or a player UserId?

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.

How i get my UserId or a player UserId?

ahoogol
2016-02-14 18:01:49

I used Custom Authentication. How i get my UserId retrieved from auth server? How i get UserId from PhotonPlayer of other player in the room (for example to add it to my friends)?

Comments

JohnTube
2016-02-15 07:37:39

Getting UserId of other actors is not possible right now.
PublishUserId option was added to RoomOptions for this purpose. I don't know if PUN has it already or not.
The solution is to send UserId as room or player property if you want to exchange it with others.

ahoogol
2016-02-15 12:03:30

@JohnTube thanks. PUN doesn't support PublishUserId. so i use custom properties. what about getting own UserId? if can get by PhotonNetwork.AuthValues.UserId after connect to photon?

JohnTube
2016-02-15 13:00:17

Let's keep that discussion on the other thread.

sosh
2016-08-18 07:50:31

Is there any update on whether the real UserId of other actors is or will be readable in the future? It seems to me that relying on the client to explicitly send userId as a player property is not secure, and could lead to impersonation etc.

JohnTube
2016-08-18 11:11:04

Hi @sosh,

Please take a look at RoomOptions.PublishUserId.

Back to top