Struct GhostComponentSerializer.State
This buffer is added to the GhostCollection singleton entity. Stores serialization meta-data for the ghost. Too large to be stored in chunk memory. Values are generated by the Source Generators.
Implements
Inherited Members
Namespace: Unity.NetCode.LowLevel.Unsafe
Assembly: solution.dll
Syntax
[InternalBufferCapacity(0)]
public struct GhostComponentSerializer.State : IBufferElementData
Fields
| Name | Description |
|---|---|
| ChangeMaskBits | The number of bits necessary for the change mask. |
| ComponentSize | The size of the component, as reported by the TypeManager. |
| ComponentType | The type of component this serializer act on. |
| CopyFromSnapshot | Delegate method used to transfer data from the snapshot buffer to the destination component. |
| CopyToSnapshot | Delegate method used to transfer the component data to the snapshot buffer. |
| Deserialize | Deserialize the component and buffer data from the received snapshot and store it inside the SnapshotDataBuffer. |
| GhostFieldsHash | The hash of all serializer fields, along with their GhostFieldAttribute options properties. Used to calculate the NetworkProtocolVersion. |
| PostSerialize | Delegate method to use to post-serialize the component when the ghost use pre-serialization optimization. |
| PostSerializeBuffer | Delegate method to use to post-serialize buffers when the ghost use pre-serialization optimization. |
| PredictDelta | Calculate the prediction delta for components and buffer. Used for delta-compression. |
| PrefabType | Store the PrefabType if the attribute is present on the component. Otherwise is set to All. TODO - Try to deduplicate this data by reading the ComponentTypeSerializationStrategy directly. |
| RestoreFromBackup | Delegate method used to restore the state of a replicated component from the GhostPredictionHistoryState buffer. Because the history buffer perform a memory copy of the whole component data, it is necessary to call this method to ensure only the replicated portion of the component is actually restored. |
| SendMask | Indicates for which type of ghosts the component should be replicated. The mask is set by code-gen base on the PrefabType constraint. |
| SendToOwner | Store the OwnerSendType if the attribute is present on the component. Otherwise is set to All. |
| SerializationStrategyIndex | Internal. Indexer into the SerializationStrategies list. |
| Serialize | Delegate method used to serialize the component data for the root entity into the outgoing data stream. Work in batch. |
| SerializeBuffer | Delegate method used to serialize the buffer content for the whole chunk. Work in batch for the whole chunk. |
| SerializeChild | Delegate method used to serialize the component data present in the child entity into the outgoing data stream. Work on a single entity at time. |
| SerializerHash | An unique hash computed by source generator that identify the serializer type. |
| SerializesEnabledBit | True if this component has the GhostEnabledBitAttribute and thus should replicate the enable bit flag. |
| SnapshotSize | The size of the component inside the snapshot buffer. |
| VariantHash | An hash identifying the specific variation used for this serializer (see GhostComponentVariationAttribute). If no variation is used, this will be the hash of the ComponentType itself, and IsDefaultSerializer will be true. |
Properties
| Name | Description |
|---|---|
| HasGhostFields | Whether SnapshotSize is greater than zero. |