How i get my UserId or a player UserId?
The whole answer can be found below.
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).
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
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.
@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?
Let's keep that discussion on the other thread.
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.
Hi @sosh,
Please take a look at RoomOptions.PublishUserId
.