Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

PhotonPlayer display other players name

$
0
0
Hi, how can I display other player's name? I have 4 players in room. I have already displayed name of local player and 1 other player. I have no idea how to display other 2 player's name.
private void UpdatePlayerTexts()
	{
		PhotonPlayer remote = PhotonNetwork.player.GetNext();
	
		PhotonPlayer local = PhotonNetwork.player;

		if (remote != null)
		{
			this.playerNames[1].text = remote.NickName + "        ";
		}

		else
		{

			//TimerFillImage.anchorMax = new Vector2(0f,1f);
			//this.TimeText.text = "";
			//this.playerNames[1].text = "waiting for another player        00";
		}

		if (local != null)
		{
			// should be this format: "YOU   00"
			//this.playerNames[0].text = "YOU   " + local.GetScore().ToString("D2");
			this.playerNames[0].text = "YOU";
		}
	}
I have tried to add
PhotonPlayer remote2 = PhotonNetwork.player.GetNext();
if(remote2 != null)
{
this.playerNames[2].text = remote2.NickName +" ";
}

But all other texts displayer only 1 other players name.
Thank you

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>