Display name on my character

Hello everybody

I’m trying to make a little rpg game, and i want to know how can i display a name on the top of every character i have? otherwise, over their head

Thank you

Create a GUIText and attach that script on it. Make it child of the character, set the target in the inspector (or change the script to get the parent) and tweak the offset.

using UnityEngine;
using System.Collections;
public class DisplayName : MonoBehaviour 
	public Transform target;
	public Vector3 offset;
	// Update is called once per frame
	void Update (){
		transform.position = Camera.main.WorldToViewportPoint( target.position ) + offset;		

Thanks for your answer but the textGUi follow me when i turn my camera around, i have made the text children of a pnj player and the target the pnj but when i turn with my player the caemra after some seconde i see the text appearing on the top of my screen

thank you