[Solved] Can't join room with the same player.NickName
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).
[Solved] Can't join room with the same "player.NickName"
LeonidB
2018-05-31 06:38:28
Hello guys! I'm facing some strange issue here.
After i updated my project to Unity 2018 and PUN 1.9, i'm facing some strange behaviour.
There is a logick in my project which sets the default player nickname to "Player".
I have 2 devices, default name is setted on both of them. Then i try to create room with one device and connect on other device, i see error:
Operation failed: OperationResponse 226: ReturnCode: 32746 (Join failed: UserId 'Player' already joined the specified game (JoinMode=0).). Parameters: {} Server: GameServer
BUT i dont set UserId anywhere. I'm only calling PhotonNetwork.player.NickName = "Player".
It seems that PUN does not generate random UserId for the session for some reason.
If i change PhotonNetwork.player.NickName = "Player1" on one of the devices, everything works ok.
And the second strange thing - before update (Unity 5.6.1 + PUN 1.85) the same code worked just fine and i have had no problems with connecting 2 players with the same nickname.
Could you please help me to solve this issue?
Thank you!
Comments
Hi @LeonidB,
PhotonPlayer.UserId
in your code. Or maybe you are using Custom Authentication and returning same UserId value.
Hello @JohnTube!
Thank you very much! It seems, if UserId is not setted manually or through custom authentication system, its automatically set as = player.PlayerName.
I'm now assigning UserId = random 6 digits string, on OnJoinedLobby and it works perfectly.