Can I call an RPC on certain player?

Hi,

If I need to send a message to certain player - is it possible?
Or the only way is to use RPCMode.Others and filter out messages on player side?

Thank you.

I know in Photon Unity Networking, you can send RPC’s to specific players because the server handles and filters the sending. Standard Unity networking probably doesn’t let you do that, you can send an extra byte to identify who the RPC is for. If it’s not for me, then I won’t do anything with it.

Script documentation says yes. There’s an Overload of RPC with a Networkplayer as target:

public void RPC(string name, NetworkPlayer target, params object[] args);

see here

No you cant’ rpc modes are:

Server Sends to the server only.
Others Sends to everyone except the sender.
OthersBuffered Sends to everyone except the sender and adds to the buffer.
All Sends to everyone.
AllBuffered Sends to everyone and adds to the buffer.

You have to find the player that you want to make execute the code, for example you can find his viewid before rpc call and then set it a funcion paramenter. Then you can check (in the rpc function) if the viewid set as parameter is equals to the object.