Remote Procedure Calls (RPCs)
RPCs are method calls on Network Behaviors that are replicated across the network. They can be used for events or to transfer data.
An important use of RPCs is to set up the game and send configuration messages. Use reliable RPCs for things like that.
An RPC example:
You use the [Rpc] attribute to mark a method as an RPC.
RPC method constraints:
Must have the return type of void.
Must only include parameters that can be networked. Same ones as the properties
[Rpc] attribute parameters
Source: the peer/peers the RPC should be sent from
Target: the peer/peers the RPC will be executed on
isReliable: whether the RPC is sent reliably or unreliably
localInvoke: whether to invoke the RPC locally or not
Source and target can be any of the following:
Owner (the server)
Input Source: the client which is providing inputs for this Network Object
Proxies: everyone except the Owner and the Input Source
Everyone: the server and every connected client
Source Connection of RPCs
If you need to know which connection (a client, or the server) the current RPC is being executed from, you can use Sandbox.RpcSource
Last updated
Was this helpful?