I made a name plate script for my multiplayer game. Which works, but its updating every frame to the other players name because I have put it in an update function. My problem is figuring out which function to use.
public string getPlayerName;
public TextMesh NAMEPLATE;
void Update () {
NAMEPLATE = gameObject.GetComponent<TextMesh>();
networkView.RPC("getName", RPCMode.All, PlayerPrefs.GetString("Player_Name"));
}
[RPC]
void getName(string name) {
NAMEPLATE.text = name;
}
As you can see, its being called every single frame. What else can I use for a function? I cant use on player connected because it wont get the first player (the server)…
thanks in advance!