Set opponent 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).
Set opponent nickname
sic_architect
2021-05-05 17:49:47
I created a game with 2 players (online). I would like to add nicknames. I added the owner nickname it was simple but how to add the opponent nickname without using the array?
https://paste.myst.rs/1vlwtrsa
Comments
Hi @sic_architect,
Thank you for choosing Photon!
Player Nickname is a player property that is automatically synchronized between players joined to the same room so no need to synchronize it via RPC!
Simply set the Nickname of the local player and all other players joined to the same room will get it updated.
sic_architect
2021-05-06 16:31:31
I set local player name, but How Can I separate both?
Hi @sic_architect,
Simply make use of player.IsLocal or photonView.IsMine etc. to know if a player is local or not.
And when you set Nickname set it to the local player only: PhotonNetwork.LocalPlayer.Nickname.