docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    About NetworkUpdateLoop

    Often there is a need to update netcode systems like RPC queue, transport IO, and others outside the standard MonoBehaviour event cycle.

    The Network Update Loop infrastructure utilizes Unity's low-level Player Loop API allowing for registering INetworkUpdateSystems with NetworkUpdate() methods to be executed at specific NetworkUpdateStages which may be either before or after MonoBehaviour-driven game logic execution.

    Typically you will interact with NetworkUpdateLoop for registration and INetworkUpdateSystem for implementation. Systems such as network tick and future features (such as network variable snapshotting) will rely on this pipeline.

    Registration

    NetworkUpdateLoop exposes four methods for registration:

    Method Registers
    void RegisterNetworkUpdate(INetworkUpdateSystem updateSystem, NetworkUpdateStage updateStage) Registers an INetworkUpdateSystem to be executed on the specified NetworkUpdateStage
    void RegisterAllNetworkUpdates(INetworkUpdateSystem updateSystem) Registers an INetworkUpdateSystem to be executed on all NetworkUpdateStages
    void UnregisterNetworkUpdate(INetworkUpdateSystem updateSystem, NetworkUpdateStage updateStage) Unregisters an INetworkUpdateSystem from the specified NetworkUpdateStage
    void UnregisterAllNetworkUpdates(INetworkUpdateSystem updateSystem) Unregisters an INetworkUpdateSystem from all NetworkUpdateStages

    Update Stages

    After injection, the player loops follows these stages. The player loop executes the Initialization stage and that invokes NetworkUpdateLoop's RunNetworkInitialization method which iterates over registered INetworkUpdateSystems in m_Initialization_Array and calls INetworkUpdateSystem.NetworkUpdate(UpdateStage) on them.

    In all NetworkUpdateStages, it iterates over an array and calls the NetworkUpdate method over INetworkUpdateSystem interface, and the pattern is repeated.

    <Mermaid chart={graph LR; A(Initialization) B(EarlyUpdate) C(FixedUpdate) D(PreUpdate) E(Update) F(PreLateUpdate) G(PostLateUpdate) A --> B --> C --> D --> E --> F --> G}/>

    Stage Method
    Initialization RunNetworkInitialization
    EarlyUpdate RunNetworkEarlyUpdate
    ScriptRunDelayedStartupFrame
    Other systems
    FixedUpdate RunNetworkFixedUpdate
    ScriptRunBehaviourFixedUpdate
    Other systems
    PreUpdate RunNetworkPreUpdate
    PhysicsUpdate
    Physics2DUpdate
    Other systems
    Update RunNetworkUpdate
    ScriptRunBehaviourUpdate
    Other systems
    PreLateUpdate RunNetworkPreLateUpdate
    ScriptRunBehaviourLateUpdate
    PostLateUpdate PlayerSendFrameComplete
    RunNetworkPostLateUpdate
    Other systems

    References

    See Network Update Loop Reference for process flow diagrams and code.

    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)