Multiplayer adding player names and health above each player

I'm making a 3rd person navy game where all the players are ships. In the networked version I want to make sure that each player's name show above their ship. I would prefer using GUIText so the text stays the same size no matter the range. Is there a good example out there, or can some one give me show me a little code to give me the general idea of how to do this?


Try this:

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);	

Use this script on the wiki.

This is going to be the key to your implementation:

Basically have a GUIText object point to a transform, and every frame set its position using that function. I think GUIText objects use normalized screen space (so 0-1 instead of 0-Screen.width/height), but that should just be a simple division by Screen.width/height to get the coordinates to be correct.

Create a 3D Text and write something in the text, now correct it to the ship's head or whatever, remove the text, add to it a `networkView` and another script from Leepo's tutorial called NetworkRigidbody or something, make sure the obseved slot is networkRigidbody script and not something else, use `PlayerPrefs` function to save the name they wrote in the beginning - shown in Leepo's tutorial. Leepo's networking tutorial :

Awesome, thanks for all the quick responses, I will check out all the links and see what works best.