- Home /
[PUN] Player Name
Hi!
I need some kind of player name above players. I tried on time with Photon.player.name but it just used your own name. How can I make a 3D text say the player's name?
Thanks
Comment
Answer by Cherno · May 18, 2014 at 03:38 PM
private var worldNamePos : Vector3;
function OnGUI()
{
worldNamePos = Camera.main.camera.WorldToScreenPoint(Vector3(transform.position.x, transform.position.y + 2.0, transform.position.z));
GUI.Label (Rect (worldNamePos .x - 50, Screen.height - worldNamePos .y - 48, 100, 50), "Name");
}
For 3D Text, you just use the character's transform.position with an y-offset appropriate for the figure's height.
The thing I was looking for was to use their PhotonNetwork name. I know how to change 3D text in script but I need it to display a name.