Struct GhostSpawnBuffer
The GhostSpawnBuffer is the data for a GhostSpawnQueue singleton. It contains a list of ghosts which will be spawned by the GhostSpawnSystem at the beginning of next frame. It is populated by the GhostReceiveSystem and there needs to be a classification system updating after the GhostReceiveSystem which sets the SpawnType so the spawn system knows how to spawn the ghost. A classification system should only modify the SpawnType and PredictedSpawnEntity fields of this struct. InternalBufferCapacity allocated to almost max out chunk memory.
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
[InternalBufferCapacity(240)]
public struct GhostSpawnBuffer : IBufferElementData
Fields
Name | Description |
---|---|
DataOffset | Offset im bytes used to retrieve from the temporary SnapshotDataBuffer, present on the GhostSpawnQueue singleton, the first received snapshot from the server. |
DynamicDataSize | The size of the initial dynamic buffers data associated with the entity. |
GhostID | The ghost id that will be assigned to the new ghost instance. |
GhostType | The index of the ghost type in the GhostCollectionPrefab collection to use to spawn to ghost. |
PredictedSpawnEntity | Entity reference assigned by a classification system, when a predicted spawned entity for a newly received ghost is found. When assigning this HasClassifiedPredictedSpawn should also be set to true. If the referenced entity is different than Null the ghost type must be set to Predicted. |
ServerSpawnTick | The tick this ghost was spawned on the server. For any predicted spawning this is the tick that should match since you are interested in when the server spawned the ghost, not when the server first sent the ghost to the client. Using this also means you are not considering ghosts becoming relevant as spawning. |
SpawnType | The type of ghost to spawn. Based on the spawn type, some components may be enable/disabled or removed from the instantiated ghost. |
Properties
Name | Description |
---|---|
HasClassifiedPredictedSpawn | Should be set to true when a ghost classification system has processed this particular ghost spawn instance. It will then not be processed again in a system running later in the frame (like the default classification system). |