docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Use GhostObjects in a project

    Set up, script, and connect networked GameObjects, from a first multiplayer scene to predicted physics and one-off events.

    Start with a complete multiplayer scene built from an empty project, then work through each part of a GhostObject workflow in more depth: replicating state, writing logic that runs in the prediction loop, managing connections, sending one-off events, and predicting physics.

    GhostObject logic runs inside the Unity Netcode prediction loop, which can run your code several times for the same tick. For background on how Unity Netcode predicts and corrects state, refer to Prediction.

    Topic Description
    Get started with GhostObjects Build a multiplayer scene from an empty project, where every connected player controls a server-authoritative, client-predicted GameObject.
    Replicate state over the network Author, replicate, and spawn a networked object using GameObjects and MonoBehaviours with GhostObjects.
    Write prediction logic in a GhostBehaviour Use the GhostBehaviour methods, time, and transform APIs correctly inside the prediction loop.
    Manage connections Start a session, respond to connection events, and inspect connections using the static Netcode class.
    Send events with RPCs and custom messages Send one-off events between the server and its clients with GhostObjects, using RPC methods and custom messages.
    Use physics with predicted GhostObjects Set up predicted GameObject physics, and write collision and trigger handling that stays correct when prediction replays a tick.

    Additional resources

    • Client and server worlds networking model
    • Synchronization with ghosts
    • Prediction
    • Interpolation and extrapolation
    In This Article
    Back to top
    Copyright © 2026 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)