I am creating a chat function for my game and it requires players to send each other messages. The messages aren’t able to get through to the other players but does show it being recognised as the player sending them.
In my Update function I have:
networkView.RPC("smn",RPCMode.All,myName,currentText,transform.position,myRace);
And in my smn function I have:
@RPC
function smn (name : String, text : String, position : Vector3, theirRace : int) {
numberOfMessages += 1;
distance = Vector3.Distance(position,transform.position);
if(distance <= talkDistance){
if(theirRace == myRace){
messages.Add(name + ": " + text);
}
if(theirRace != myRace){
messages.Add(name + ": Blah Blah Blah.... what the fuck are they saying?");
}
}
}
Could someone please give me some information on why this doesn’t work and how to fix it?