- Home /
Question by
$$anonymous$$ · Oct 25, 2012 at 11:06 PM ·
networkrpcsynchronizationname
object naming via network
Hey, I am nearly finished with my TronGame but i just cant figure out how i can share the names of the players via network.. here is the Code:
function Update(){
if(networkView.isMine){
networkView.RPC("SetName",RPCMode.All,PlayerPrefs.GetString("PlayerName"),gameObject.networkView.viewID);
}
@RPC
function SetName(naming:String,id:NetworkViewID){
foo=NetworkView.Find(id).gameObject;
foo.name=naming;
foo.GetComponent(PlayerController).playerName=naming;
}
My idea was if we own the gameObject, send a RPC Call to all other players containing the networkviewID and our name and tell them to set our name. However this doesnt really work, the last player who joins sets the name of all TronBikes to his name?!
Thanks for your help^^
Comment
Your answer
Follow this Question
Related Questions
TextMesh sync player names with other players 1 Answer
Displaying players name above in multiplayer 1 Answer
RPC Player Name and show it above head 0 Answers
Send a mesh via Network 2 Answers