- Home /
The question is answered
Sending RPC to everyone except one specific player
I would like server to broadcast some message from one client between other clients, without the original client sender receiving again. I know i could just simply loop through all connected and skip the sender, but i also know that RakNet has this feature (sending to everyone except one) and that it would be probably more effective.
Answer by Benproductions1 · Jun 30, 2012 at 01:29 PM
To be honest this is a stupid question, that could be answered by just taking a look at the Unity Docs, but nevertheless here is the answer :)
networkView.RPC("MyFunction", RPCMode.Others, myvariable);
The RPCMode allows you to regulate who receives the RPC. This includes only the server, everyone, and everyone except the sender. Some of these can also be buffered. More info here; http://docs.unity3d.com/Documentation/ScriptReference/RPCMode.html And here: http://docs.unity3d.com/Documentation/Components/net-RPCDetails.html
Hope this helps :D
Sorry, you didn't understand. I don't want to exclude the sender of this RPC, but other chosen peer (peer who sent an RPC to the server and now server broadcasts this message to other peers except for the peer that sent it to the server.) RakNet does have this option, but i can't see it in Unity
Thanks for clearing that up :) that is possible in unity, but you would have to write it yourself!
That's what i did, i just thought maybe there would be less overhead or something
Follow this Question
Related Questions
Can NetworkView state synchronization send to just the server, rather than all peers? 0 Answers
Odd behaviour when sending rpc from client to server 1 Answer
Passing a variable from a client to server 1 Answer
Buffered Network.Destroy? 0 Answers
Making a GUI Label carrying a variable update when changed to all clients on network 0 Answers