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: Unity.NetCode.dll
Syntax
[InternalBufferCapacity(0)]
public struct GhostComponentSerializer.State : IBufferElementData
Fields
ChangeMaskBits
The number of bits necessary for the change mask.
Declaration
public int ChangeMaskBits
Field Value
Type | Description |
---|---|
int |
ComponentSize
The size of the component, as reported by the Type
Declaration
public int ComponentSize
Field Value
Type | Description |
---|---|
int |
ComponentType
The type of component this serializer act on.
Declaration
public ComponentType ComponentType
Field Value
Type | Description |
---|---|
Component |
CopyFromSnapshot
Delegate method used to transfer data from the snapshot buffer to the destination component.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.CopyToFromSnapshotDelegate> CopyFromSnapshot
Field Value
Type | Description |
---|---|
Portable |
CopyToSnapshot
Delegate method used to transfer the component data to the snapshot buffer.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.CopyToFromSnapshotDelegate> CopyToSnapshot
Field Value
Type | Description |
---|---|
Portable |
Deserialize
Deserialize the component and buffer data from the received snapshot and store it inside the Snapshot
Declaration
public PortableFunctionPointer<GhostComponentSerializer.DeserializeDelegate> Deserialize
Field Value
Type | Description |
---|---|
Portable |
GhostFieldsHash
The hash of all serializer fields, along with their Ghost
Declaration
public ulong GhostFieldsHash
Field Value
Type | Description |
---|---|
ulong |
NumPredictionErrors
The number of predicted errors that is calculated by the Ghost
Declaration
public int NumPredictionErrors
Field Value
Type | Description |
---|---|
int |
PostSerialize
Delegate method to use to post-serialize the component when the ghost use pre-serialization optimization.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.PostSerializeDelegate> PostSerialize
Field Value
Type | Description |
---|---|
Portable |
PostSerializeBuffer
Delegate method to use to post-serialize buffers when the ghost use pre-serialization optimization.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.PostSerializeBufferDelegate> PostSerializeBuffer
Field Value
Type | Description |
---|---|
Portable |
PredictDelta
Calculate the prediction delta for components and buffer. Used for delta-compression.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.PredictDeltaDelegate> PredictDelta
Field Value
Type | Description |
---|---|
Portable |
PredictionErrorNames
String buffer, containing the list of all replicated field names. Empty for component type that can be only interpolated.
(see Prefab
Declaration
public FixedString512Bytes PredictionErrorNames
Field Value
Type | Description |
---|---|
Fixed |
PrefabType
Store the Prefab
Declaration
public GhostPrefabType PrefabType
Field Value
Type | Description |
---|---|
Ghost |
ProfilerMarker
Marker used to profile the performance of the serializer.
Declaration
public ProfilerMarker ProfilerMarker
Field Value
Type | Description |
---|---|
Profiler |
ReportPredictionErrors
Used by the Ghost
Declaration
public PortableFunctionPointer<GhostComponentSerializer.ReportPredictionErrorsDelegate> ReportPredictionErrors
Field Value
Type | Description |
---|---|
Portable |
RestoreFromBackup
Delegate method used to restore the state of a replicated component from the Ghost
Declaration
public PortableFunctionPointer<GhostComponentSerializer.RestoreFromBackupDelegate> RestoreFromBackup
Field Value
Type | Description |
---|---|
Portable |
SendMask
Indicates for which type of ghosts the component should be replicated. The mask is set by code-gen base on the
Prefab
Declaration
public GhostSendType SendMask
Field Value
Type | Description |
---|---|
Ghost |
SendToOwner
Store the Owner
Declaration
public SendToOwnerType SendToOwner
Field Value
Type | Description |
---|---|
Send |
SerializationStrategyIndex
Internal. Indexer into the Serialization
Declaration
public short SerializationStrategyIndex
Field Value
Type | Description |
---|---|
short |
Serialize
Delegate method used to serialize the component data for the root entity into the outgoing data stream. Work in batch.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.SerializeDelegate> Serialize
Field Value
Type | Description |
---|---|
Portable |
SerializeBuffer
Delegate method used to serialize the buffer content for the whole chunk. Work in batch for the whole chunk.
Declaration
public PortableFunctionPointer<GhostComponentSerializer.SerializeBufferDelegate> SerializeBuffer
Field Value
Type | Description |
---|---|
Portable |
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.
Declaration
[Obsolete("The SerializeChild method has been deprecated. Please use only Serialize instead", false)]
public PortableFunctionPointer<GhostComponentSerializer.SerializeChildDelegate> SerializeChild
Field Value
Type | Description |
---|---|
Portable |
SerializerHash
An unique hash computed by source generator that identify the serializer type.
Declaration
public ulong SerializerHash
Field Value
Type | Description |
---|---|
ulong |
SerializesEnabledBit
True if this component has the Ghost
Declaration
public byte SerializesEnabledBit
Field Value
Type | Description |
---|---|
byte |
Remarks
Note that serializing the enabled bit is different from the main "serializer". I.e. "Empty Variants" can have serialized enable bits.
SnapshotSize
The size of the component inside the snapshot buffer.
Declaration
public int SnapshotSize
Field Value
Type | Description |
---|---|
int |
VariantHash
An hash identifying the specific variation used for this serializer (see Ghost
Declaration
public ulong VariantHash
Field Value
Type | Description |
---|---|
ulong |
VariantTypeFullNameHash
For internal use only. The hash of the ghost variation type fullname. Used mostly for validation
Declaration
public ulong VariantTypeFullNameHash
Field Value
Type | Description |
---|---|
ulong |
Properties
HasGhostFields
Whether SnapshotSize is greater than zero.
Declaration
public bool HasGhostFields { get; }
Property Value
Type | Description |
---|---|
bool |