docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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
    ISystem
    ISystemCompilerGenerated
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    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

    Methods

    OnCreate(ref SystemState)

    Declaration
    public void OnCreate(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    OnCreateForCompiler(ref SystemState)

    Declaration
    public void OnCreateForCompiler(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    OnDestroy(ref SystemState)

    Declaration
    [BurstCompile]
    public void OnDestroy(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    OnUpdate(ref SystemState)

    Declaration
    [BurstCompile]
    public void OnUpdate(ref SystemState state)
    Parameters
    Type Name Description
    SystemState state

    Implements

    Unity.Entities.ISystem
    Unity.Entities.ISystemCompilerGenerated
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)