Struct RpcSystem
The system responsible for sending and receiving RPCs.
The RpcSystem flushes all the outgoing RPCs scheduled in the OutgoingRpcDataStreamBuffer for all the active connections. Multiple RPCs can be raised by a world (to be sent in a single frame) to each connection. Therefore, in order to reduce the number of in-flight reliable messages, the system tries to coalesce multiple RPCs into a single packet.
Because packet queue size is limited (Unity.Networking.Transport.NetworkParameterConstants.SendQueueCapacity and Unity.Networking.Transport.NetworkConfigParameter), the number of available packets may not be sufficient to flush the queue entirely. In that case, the pending messages are going to attempt to be sent during the next frame (recursively) (or when a resource is available).
When an rpc packet is received, it is first handled by the NetworkStreamReceiveSystem, which decodes the incoming network packet and appends it to the IncomingRpcDataStreamBuffer for the connection that received the message. The RpcSystem will then dequeue all the received messages, and dispatch them by invoking their execute method (IRpcCommandSerializer<T> and RpcExecutor).
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation|WorldSystemFilterFlags.ClientSimulation|WorldSystemFilterFlags.ThinClientSimulation, WorldSystemFilterFlags.Default)]
[UpdateInGroup(typeof(SimulationSystemGroup), OrderLast = true)]
[UpdateAfter(typeof(EndSimulationEntityCommandBufferSystem))]
[BurstCompile]
public struct RpcSystem : ISystem, ISystemCompilerGenerated