When a client sends an RPC, is it possible for the pickup, eg. Server, to by function get that senders network ID or IP, or do I need to attach it from the sender, as a variable, eg. Sender : String and send with the RPC? Seems a little stupid.
Add a NetworkMessageInfo parameter onto your RPC method but don’t worry about including it when you call the RPC, it will be automatically filled in:
// Somewhere...
networkView.RPC("AnRPCMethod", RPCMode.Others, "String sent", new Vector3(1f,4f,2f) );
// The RPC
[RPC] public void AnRPCMethod(string aString, Vector3 aVector, NetworkMessageInfo info) {
// Do some things
NetworkPlayer netPlayer = info.sender;
string playerIP = netPlayer.ipAddress;
}
See: NetworkMessageInfo