Someone please guide me, how to retrieve and display the name of the player in the game multiplayer as shown in the following video: www.youtube.com/watch?v=gmCstH5nPsk
Thanks you.
Do you want us to explain how to make a multiplayer game or just how to show a text on top of an object ?
What have you done yourself already ?
sorry for my greed.yes if you can, please appels to help both the
but his just this priority "just how to show a text on top of an object "
thank you very much!
Have a look on the wiki, I think it has a script that does exactly what you want. I think it’s called object label or somehting.
yep, that looks like the one.
I assigned the script to guiText under the guidance (guitext in the player prefab), then I wrote another script getName assigned to Guitext, of this scritp I write a method [RPC] and referred to it as the code below:
but the display name of player is not the owner of it moves incorrectly, pls guide
Thanks.
I have no idea, you will need to debug your script yourself.
Or use a simple version of the gui label :
using UnityEngine;
public class ObjectLabel : MonoBehaviour
{
public string playerName = "Test Player";
Vector3 screenPos;
void Update()
{
screenPos = Camera.main.WorldToScreenPoint(transform.position);
}
void OnGUI()
{
GUI.Label(new Rect(screenPos.x - 37.5f, Screen.height - screenPos.y -25, 75, 25), playerName);
}
}
yes, Thanks