docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ServerPopulatePrespawnedGhostsSystem

    Responsible for assigning a unique ghostId to each pre-spawned ghost, and and adding the ghosts to the spawned ghosts maps. Relies on the previous initializations step to determine the subscene subset to process.

    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.Default)]
    [UpdateInGroup(typeof(PrespawnGhostSystemGroup))]
    [UpdateAfter(typeof(PrespawnGhostInitializationSystem))]
    [BurstCompile]
    public struct ServerPopulatePrespawnedGhostsSystem : ISystem, ISystemCompilerGenerated
    Remarks

    The server is authoritative and it is responsible for assigning unique id ranges to the each scene. For each section that present prespawn ghosts, the prespawn hash, id range and baseline hash are sent to client as part of the streaming protocol. Clients will use the received subscene hash and baseline hash for validation and the ghost range to assign the ghost id to the pre-spawned ghosts like the server. This remove any necessity for loading order determinism. Finally, clients will ack the server about the loaded scenes and the server, upon ack receipt, will start streaming the pre-spawned ghosts

    ### The Full Prespawn Subscene Sync Protocol

    The Server calculates the prespawn baselines. The Server assigns runtime ghost IDs to the prespawned ghosts. The Server stores the `SubSceneHash`, `BaselineHash`, `FirstGhostId`, and `PrespawnCount` inside the the `PrespawnSceneLoaded` collection. The Server creates a new ghost with a `PrespawnSceneLoaded` buffer that is serialized to the clients.

    ClientPopulatePrespawnedGhostsSystem

    Implements

    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)