using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class PlayerName : NetworkBehaviour
{
[SyncVar]
public string playerCurrentName;
public TextMesh playerNameMesh;
void Update()
{
if (!isServer)
return;
playerNameMesh.text = playerCurrentName;
GetComponent<Transform>().name = playerCurrentName;
}
}
Nothing really shows up on the client side, but the host sees everything
about this video, It sends the command to server to change the username when hit change button, There is an issue with it in practical use, Let’s say we are making some sort of game that all players spawns in a single scene, and we have to show some player data above all player’s heads,If we use this method, and we spawn in this scene after 2, 3 players, how to let those players connected before me send the player data ?