Networking Player Nametag

Hello all, I have setup a multiplayer game and it is running smoothly. One problem I am experiencing though his how to implement a label that is unique to each player that is their username displayed above their head. Any tips? Thanks all. :slight_smile:

Edit: Oh and there is a chat system impleneted as well, the name from the chat system when they type a message is entered in the previous scene. Can I connect the chat system name to the name above the head?

wiki here


private var localName:String; // Holds the local player name
private var namePlatePos : Vector3;
var namePlate:GUIStyle;
function OnGUI() {
        // Place the name plate where the gameObject (player prefab) is
        namePlatePos = Camera.main.WorldToScreenPoint(gameObject.transform.position);  
        GUI.Label(Rect((namePlatePos.x-50), (Screen.height - namePlatePos.y+10), 100, 50), localName, namePlate);  

I found this in another question/answers when looking for the same fix. Noticed this has gone unanswered so I wanted to contribute.