Skip to main content

Messaging System and RPCs

The multiplayer framework provides two main network constructs to execute logic on either server-side or client-side: ServerRpc and ClientRpc. This concept is often called Remote Procedure Call (RPC) and has wide adoption across the industry.

info

For more information see the wikipedia entry on Remote Procedure Call's.

RPCs#

Unity MLAPI provides a refactored Remote Procedure Call (RPC) which provides increased performance, significantly reduced boilerplate code, and extensibility for future-proofed code. MLAPI RPC includes ServerRpc and ClientRpc to execute logic on the server and client-side. This provides a single performant unified RPC solution, replacing previous MLAPI Convenience and Performance RPC.

See the following information:

Migration and Compatibility

See RPC Migration and Compatibility for more information on updates, cross-compatibility, and deprecated methods for Unity RPC.

RPC method calls#

A typical framework user (Unity developer) can declare multiple RPCs under a NetworkBehaviour and inbound/outbound RPC calls will be replicated as a part of its replication in a network frame.

A method turned into an RPC is no longer a regular method, it will have its own implications on direct calls and in the network pipeline. See Execution Table.

Network Update Loop#

See Network Update Loop for information on the update infrastructure.