- Home /
[PUN2] Player in PhotonNetwork.PlayerList has no UserId
Hello,
I have a room with two players in it.
When checking PhotonNetwork.PlayerList
, only the local player has a UserId. The other has "null". It doesn't matter if the user is the MasterClient or not.
I tried to add this code before connecting, but to no aval:
if (PhotonNetwork.AuthValues == null)
{
PhotonNetwork.AuthValues = new AuthenticationValues(System.Guid.NewGuid().ToString());
}
else
{
PhotonNetwork.AuthValues.UserId = System.Guid.NewGuid().ToString();
}
Any idea why this is happening?
I am also seeing this behavior. I was trying to cache things by UserID, but it's only set for local players.
Answer by keevee · May 11, 2020 at 01:09 AM
I was running into this issue, and found a 'gotcha' in the documentation of UserID:
UserId of the player, available when the room got created with RoomOptions.PublishUserId = true.
Like this:
RoomOptions roomOpts = new RoomOptions()
{
IsVisible = true,
IsOpen = true,
MaxPlayers = 10,
PublishUserId = true
};
Your answer
Follow this Question
Related Questions
Help with PUN PhotonNetworkView stuff. 1 Answer
Photon Pun build works only locally, but not on another computer 2 Answers
[resolved] Visual Studio does not find a namespace from the project 1 Answer
Render a live webcamtexture in photon 2 1 Answer
Photon pun 2 how to get the position of a Photon.Realtime.Player 0 Answers