Update playerName for FindFriends without reconnecting
Options
Is there a way to update he playerName without reconnecting? From what I have seen is that you have to set the playerName before connecting.
My game flow works like this for new players
1. Player starts the game as an anonymous player
2. Player clicks Facebook and it returns his ID
3. Then I set PhotonNetwork.playerName = facebookID
4. Disconnect and reconnect this is the step I want to skip!
5. PlayerName is updated and other people can see the status
My game flow works like this for new players
1. Player starts the game as an anonymous player
2. Player clicks Facebook and it returns his ID
3. Then I set PhotonNetwork.playerName = facebookID
4. Disconnect and reconnect this is the step I want to skip!
5. PlayerName is updated and other people can see the status
0
Comments
-
Hi @brianasu,
I moved the discussion to PUN category from DotNet.
What PUN version do you use?
I think what you're asking is not directly related to FindFriends operation.
PlayerName is meant to be used for display name, like facebook name for instance.
UserID however can be set to facebook ID.
In any case, setting PlayerName from client should updated it on server and broadcast new value to other actors in same room when joined to one.0 -
I'm using Unity SDK version 1.73.
From what I've read PhotonNetwork.FindFriends(string[] ids) uses the PhotonNetwork.playerName as an ID lookup.
http://doc-api.exitgames.com/en/pun/current/class_photon_network.html#a5c08f89cdf5766c1b69d5b7b8786b734
I use the facebook ID as their playerName for a unique global identifier. The problem is that playerName will not be updated on the master server unless I reconnect.0 -
Hi,
I can confirm that the Player name is updated across the network on all clients. Maybe you are not setting it properly when connected. You don't need to disconnect and reconnect.
set it from the photonView itself, using:this.photonView.owner.name = "TEST";
this code would be on a script extending Photon.PunBehaviour on a network prefab instance.
Let me know if that still doesn't work on your end, I'll do a working sample.
Bye,
Jean
0 -
Thanks Jean I'll give that a try but is owner.name something that is used within a room but not in the master server scope?0
-
Hi,
yeah, in master or lobby, you would simply use the local player, since there are no other players connected on your machine.
Bye,
Jean0