Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How do I set other clients names up with 3d text?

Discussion in 'Multiplayer' started by Durins-Bane, Feb 1, 2017.

  1. Durins-Bane

    Durins-Bane

    Joined:
    Sep 21, 2012
    Posts:
    175
    Im using a syncvar that has each players name in it when they spawn so technically the other players in the local game will have their own names on their characters.

    How do I get the clients to set the other players names that join locally.

    Code (CSharp):
    1.  public void SetPlayerNames(string name) {
    2.  
    3.         //thisPlayers3dName.GetComponent<TextMesh>().text = playerUniqueName;
    4.         if (isLocalPlayer)
    5.         {
    6.             Debug.LogError("SET LOCAL PLAYERS NAME");
    7.             Debug.LogError("SetPlayerNamesforEachlocally " + name);
    8.            
    9.         }else {
    10.          
    11.             Debug.LogError("Shoulve set other players name " + name);
    12.             transform.GetChild(1).GetChild(0).GetComponent<TextMesh>().text = "TEST LOCAL OTHER PLAYERS";
    13.         }
    14.         //myTransform.GetChild(1).GetChild(0).GetComponent<TextMesh>().text = name;
    15.  
    16.     }
     
  2. Durins-Bane

    Durins-Bane

    Joined:
    Sep 21, 2012
    Posts:
    175
    I call that method on Start so if I am thinking about this right.. whenever a new player spawns into the game it should setup every other players name locally above their heads