ClientRpc can be invoked by the server to be executed on a client.
Developers can declare a
ClientRpc by marking a method with
[ClientRpc] attribute and making sure to have
ClientRpc suffix in the method name.
Developers can invoke a
ClientRpc by making a direct function call with parameters:
Marking method with
[ClientRpc] attribute and putting
ClientRpc suffix to the method name are required, otherwise it will prompt error messages:
[ClientRpc] attribute and matching
...ClientRpc suffix in the method name are there to make it crystal clear for RPC call sites to know when they are executing an RPC, it will be replicated and executed on the client-side, without necessarily jumping into original RPC method declaration to find out if it was an RPC, if so whether it is a ServerRpc or
The following code provides an example of using
ClientRpcSendParameters, which will allow you to send a
ClientRpc to a specific Client connection(s) whereas the default MLAPI's behavior is to broadcast to every single client.