Player names not showing up tried every possible way.

So after a long battle with using a Syncvar to attempt to display player names im absolutely stumped at this point. the command

which us suppose to send this information to the server as far as i understand

    void hooknametheplayer(string namestring)
    {
        overheadname.text = namestring;

    }

this function is attached to the input field
here → Screenshot - 52857692aa4a656603cca9cf8887ebf8 - Gyazo

this command which is acutally suppose to set the text displayed above the player heads does nothing except change the variable on a client

as you can see here namestring is a Syncvar which as far as i understand synchronizes it with the server and the server synchronizes it with the client

  public Transform mychild;
  public GameObject targeting;
  public GameObject thecamera;
  [SyncVar]
  public string namestring;
  public int howmanyplayers;
  public bool dashanimation;
  public GameObject dashclone;


/code]

the result however is the server/host can change the name of the other player. the client can see the name the host/server has set for them but the client cannot set a name for him self or the other person.


if you know of a way to Synchronize text across the server please share your method as all the methods i have found are old and use the 3d text functions. i am willing to completely rewrite the player name program if you can provide a short tutorial, script, etc.

Its works but not show others player names in clients.

public Text NombredelJugador;

[SyncVar] public string playerID;

public override void OnStartLocalPlayer ()
{
string myPlayerID = string.Format(“Player{0}”, netId.Value);
CmdSetPlayerID(myPlayerID);
}

[Command]
void CmdSetPlayerID(string newID)
{
playerID = newID;
Rpcactualizanombre(newID);
}

[ClientRpc]
void Rpcactualizanombre(string Nombre){
this.NombredelJugador.text = Nombre;
}

is there a simpler one that just sends the overhead text to change on the server?

If you have a string SyncVar it should work for you.
-Instantiate object on server
-Assign player name on server
-AddPlayer/spawn player on server
-On the client as part of the spawn data package the serialized name data will also be sent and read during OnDeserialize
-During Start the player name should be accessible on the clients (not during awake or anytime before OnDeserialize is called).