- Home /
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. :)
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?
Display text floating in a space above a character in the game over a network so everyone can see. I tried using Guitext but it's all screwy.
Thanks for the reply.
Answer by Welias D. · Aug 03, 2013 at 08:16 AM
or
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.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Networking for 1v1 rooms 0 Answers
My network server doesn't work. 0 Answers
How to make a simple network server? 1 Answer
Can you create a Stand alone server for your game? 0 Answers