Player names with photon PUN

i have been working for hours to try and figure out how to display player names above a player, but no matter what i try all the players names change to your name. they wont sync across network.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerNameController : Photon.MonoBehaviour {
    public int MyIndex;
    string PlayerName;
    public CameraController CameraControl;
    InputField PlayerNameInput;
    void Start()
        MyIndex = Random.Range(-99999, 99999);
        CameraControl = GameObject.Find("Main Camera").GetComponent<CameraController>();
        PlayerNameInput = GameObject.Find("PlayerNameInput").GetComponent<InputField>();

    private void Update()
        // Doing the right thing
        PlayerName = PlayerNameInput.text;
        GameObject[] Names = GameObject.FindGameObjectsWithTag("PlayerTexts");
        if (PlayerNameInput != null && photonView.isMine == true)
            transform.GetComponent<TextMesh>().text = PlayerName;
        // Sending the variables
        photonView.RPC("NameReceive", PhotonTargets.All, PlayerName, MyIndex);
        PlayerName =;
    // Recieving the data
    void NameReceive(string PlayersName, int MyInt)
        // Checking if Index is same
        GameObject[] i = GameObject.FindGameObjectsWithTag("PlayerTexts");
        foreach (GameObject thing in i)
            if (thing.GetComponent<PlayerNameController>().MyIndex == MyInt && photonView.isMine == false)
                // Changing the text
                thing.GetComponent<TextMesh>().text = PlayersName;

Hi @ratgamer,

you don’t have to use a RPC to synchronize nick names. You can use PhotonNetwork.player.NickName instead, which is automatically synchronized across all clients in the room. To display the correct name on every client, you can use the already attached PhotonView component and get the nick name. To do so you have to use photonView.owner.NickName in your source code.