duplicate players from same ipaddress
Options
Kekora
✭
hi, I noticed an issue today. I make a windows build and run it, and log in at the exact same time as my Unity logs in to the game, two players become the same name, this only happens when connecting at same time.
I am using custom authentication on the site with version checking. Would AddAuthParameter("user" help differentiate each client to the cloud during connection process?
Pun getting name from PhotonNetwork.playerName.
Also, not sure if we can do custom auth with Photon Chat, I didn't find anything about it.
thanks,
I am using custom authentication on the site with version checking. Would AddAuthParameter("user" help differentiate each client to the cloud during connection process?
Pun getting name from PhotonNetwork.playerName.
Also, not sure if we can do custom auth with Photon Chat, I didn't find anything about it.
thanks,
0
Comments
-
Hi @Kekora,
I don't think IP addresses have anything to do with this.
In fact I still do not see the issue here. I do not see how and why you are getting same nickname on two different clients if you do not set the same nickname from those same two clients and you do not return it in the custom authentication response.
What are the UserIDs for those clients? If you do not set one explicitly from client or from web server then Photon Servers will return a random GUID. So I doubt you will receive two identical ones.
If you want to have a single connection per user then you can implement it in your custom authentication. Just send credentials per user and "start"/store a user session on web server. You can make use of WebRPC and WebHooks to end the session (know when a user has been disconnected to avoid clients being stuck due to endless session).
You can do custom authentication with Photon Chat.0 -
maybe I am doing something wrong then.
I checked userId with..Debug.Log("userid is " + PhotonNetwork.AuthValues.UserId);
and I received this on one client
userid is 9bad1d7a-2129-4259-a9a8-b58690623661
and this on the other client
userid is 760d47aa-ab21-4cd5-8151-d0f7c02d38fc
so they are different. lets look at the way the playerName is being set and read?
it starts off as text in a text field...string userID = Username_field.text.ToString(); PlayerPrefs.SetString("playername", userID); //set it for loading in next scene
in one of the next scenes, a script is called to connect to PUN.public void OnJoinedRoom() { PhotonNetwork.playerName = PlayerPrefs.GetString("playername"); //set our player name
0 -
Having same playerName from Editor and standalone build on same machine is expected as you're loading and saving same shared PlayerPref. You can avoid this by saving Editor playerName separately. e.g.:
save:string userID = Username_field.text.ToString(); #if UNITY_EDITOR PlayerPrefs.SetString("editor_playername", userID); //set it for loading in next scene #else PlayerPrefs.SetString("playername", userID); //set it for loading in next scene #endif
load:public void OnJoinedRoom() { #if UNITY_EDITOR PhotonNetwork.playerName = PlayerPrefs.GetString("editor_playername"); //set our player name #else PhotonNetwork.playerName = PlayerPrefs.GetString("playername"); //set our player name #endif
1 -
thank you very much
all good now0