Remote Procedure Calls
Remote Procedure Calls (RPCs) are a way of calling a method from within a script across the network. In our system you can mark a function in a class that derives from
SimpleNetworkedMonoBehavior or any of it's derivatives (such as
NetworkedMonoBehavior) with the attribute
"[BRPC]" (as seen in the script above on line 7). This will allow this particular method to be called from across the network via its string name.
When you call an RPC you can do so by calling the method RPC（） that is a part of the class that has the RPC function in question (as seen on line 18). The first argument of this method is the string name of the method you wish to call, in the case of the example, this would be "MoveBall". The second argument of the RPC are the arguments that are to be passed into the method in the order that the function signature has them in.
Note: There is an overload to the RPC function in which case the second argument is a NetworkReceivers enum to stat who should be executing this method. If this is the second argument, then the consecutive arguments after this should be the arguments that are to be passed into the method in the order that the function signature has them in.
If you chose to use the NetworkReceivers argument, then you can select between options that are buffered and ones that are not buffered. The buffered arguments mean that every time someone new connects to the game, they will call this RPC method immediately. Of course you can set delays inside of the method for players who just connected to lower the load of what happens upon connection.