Struct ServerPopulatePrespawnedGhostsSystem
Responsible for assigning a unique ghost
Inherited Members
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.