Photon Network MultiPlayer names Help C#

The title says what I am trying to do. I have read through the Photon API, and tons of threads, but I still can not for my life get names to work. So this is what I currently have.

When you log on, I have this script.

using UnityEngine;
using System.Collections;

public class SetName : MonoBehaviour {

	private bool setname = false;

	public GameObject Menu;

	// Use this for initialization
	void Start () {
	
	}

	void OnGUI(){

		if(!(PhotonNetwork.connectionStateDetailed.ToString () == "Joined")){
			return;
		}

		if(setname){
			return;
		}

		PhotonNetwork.player.name = GUI.TextField(new Rect(0, 0, 100, 100), PhotonNetwork.player.name);

		if(GUI.Button(new Rect(Screen.width / 2 + 50, Screen.height/2 -50 , 100, 100), "Enter")){
			if(PhotonNetwork.player.name == ""){
				Debug.LogError("Enter A Name!");
			}else{
				Menu.SetActive(true);
				setname = true;
			}
		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

Ok, so now lets say my player is called “Bob.”

When I spawn my player it’s PhotonView displays “Bob,” as its name.

From this I can work out that I have set the name properly.

So if I build this and run the game as well as unity, I can try this two players. So in unity I call my player “Player 1”, and in the other game “Player 2”. If I look in the unity game object list, I can now see both my players. If I click on the player controlled though unity, it is called “Player 1.” But when I click on the other one, it says that it has not been named.

What am I doing wrong?

Honestly i don’t think it’s an error. If you don’t serialize the name, or if you don’t use an RPC it’s normal that YOU as the Unity Editor don’t see changes that happened in other game istances.

I can ensure you that everything will be going to be fine, if you script everything correctly because when you are doing for example a chat script, or a shooting script, you will use an RPC function that will be executed in every instance with the parameters that you set from one…

i hope i helped you

You only have to set PhotonNetwork.playerName to set “this client’s” user’s name. This is synchronized automatically in a room.

Per networked object, you can get the PhotonView component and access the owner.name.

Take a look at ShowInfoOfPlayer.cs (in newer PUN packages). It’s a component which you could add to a character prefab.

A little late but this script works fine all you gotta do is make a text mesh and assign it.

public TextMesh text;

	// Use this for initialization
	void Start () {

		text.text = photonView.owner.name;
	}
	
	// Update is called once per frame
	void Update () {
	
	}