docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct Unity_NetCode_Generated_Unity_NetCode_GhostOwnerGhostComponentSerializer

    Auto-Generated struct implementing the IGhostSerializer and used to serialize/deserialize components and buffers.

    Implements
    IGhostSerializer
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity_NetCode_Generated_Unity_NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    [BurstCompile]
    public struct Unity_NetCode_Generated_Unity_NetCode_GhostOwnerGhostComponentSerializer : IGhostSerializer

    Properties

    ChangeMaskSizeInBits

    The number of bits used for the change mask.

    Declaration
    public int ChangeMaskSizeInBits { get; }
    Property Value
    Type Description
    int

    HasGhostFields

    Denote if fields are serialized or not.

    Declaration
    public bool HasGhostFields { get; }
    Property Value
    Type Description
    bool

    SizeInSnapshot

    The size in bytes of the Snasphot struct.

    Declaration
    public int SizeInSnapshot { get; }
    Property Value
    Type Description
    int

    Methods

    CalculateChangeMask(IntPtr, IntPtr, IntPtr, int)

    Compute the change mask for the snapshot in respect to the given baseline

    Declaration
    public void CalculateChangeMask(IntPtr snapshot, IntPtr baseline, IntPtr changeMaskData, int startOffset)
    Parameters
    Type Name Description
    IntPtr snapshot

    Snapshot pointer

    IntPtr baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    CopyFromSnapshot(in GhostDeserializerState, IntPtr, float, float, IntPtr, IntPtr)

    Copy/Convert the component data to the snapshot.

    Declaration
    public void CopyFromSnapshot(in GhostDeserializerState serializerState, IntPtr component, float snapshotInterpolationFactor, float snapshotInterpolationFactorRaw, IntPtr snapshotBefore, IntPtr snapshotAfter)
    Parameters
    Type Name Description
    GhostDeserializerState serializerState

    Serializer state

    IntPtr component

    Component

    float snapshotInterpolationFactor
    float snapshotInterpolationFactorRaw
    IntPtr snapshotBefore
    IntPtr snapshotAfter

    CopyToSnapshot(in GhostSerializerState, IntPtr, IntPtr)

    Copy/Convert the component data to the snapshot.

    Declaration
    public void CopyToSnapshot(in GhostSerializerState serializerState, IntPtr snapshot, IntPtr component)
    Parameters
    Type Name Description
    GhostSerializerState serializerState

    Serializer state

    IntPtr snapshot

    Snapshot pointer

    IntPtr component

    Component

    Deserialize(ref DataStreamReader, in StreamCompressionModel, IntPtr, int, IntPtr, IntPtr)

    Read the data from the reader stream into the snapshot data.

    Declaration
    public void Deserialize(ref DataStreamReader reader, in StreamCompressionModel compressionModel, IntPtr changeMask, int startOffset, IntPtr snapshot, IntPtr baseline)
    Parameters
    Type Name Description
    DataStreamReader reader

    Data stream reader

    StreamCompressionModel compressionModel

    compression model

    IntPtr changeMask

    change mask

    int startOffset

    start offset

    IntPtr snapshot

    Snapshot pointer

    IntPtr baseline

    Snapshot baseline

    PredictDelta(IntPtr, IntPtr, IntPtr, ref GhostDeltaPredictor)

    Calculate the predicted snapshot from the two baseline

    Declaration
    public void PredictDelta(IntPtr snapshotData, IntPtr baseline1Data, IntPtr baseline2Data, ref GhostDeltaPredictor predictor)
    Parameters
    Type Name Description
    IntPtr snapshotData

    Predicted snapshot data

    IntPtr baseline1Data

    Snapshot baseline

    IntPtr baseline2Data

    Snapshot baseline

    GhostDeltaPredictor predictor

    Delta predictor

    ReportPredictionErrors(IntPtr, IntPtr, IntPtr, int)

    Calculate the prediction error for this component.

    Declaration
    public void ReportPredictionErrors(IntPtr component, IntPtr backup, IntPtr errorsList, int errorsCount)
    Parameters
    Type Name Description
    IntPtr component

    Component

    IntPtr backup

    Backup buffer

    IntPtr errorsList

    Data for errors

    int errorsCount

    Error count

    RestoreFromBackup(IntPtr, IntPtr)

    Read the data from the reader stream into the snapshot data.

    Declaration
    public void RestoreFromBackup(IntPtr component, IntPtr backup)
    Parameters
    Type Name Description
    IntPtr component
    IntPtr backup

    Serialize(IntPtr, IntPtr, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)

    Serialise the snapshot dato to the writer based on the calculated changemask. Expecte the changemask bits be all already set.

    Declaration
    public void Serialize(IntPtr snapshot, IntPtr baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    IntPtr snapshot

    Snapshot pointer

    IntPtr baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    start offset

    DataStreamWriter writer

    data stream writer

    StreamCompressionModel compressionModel

    comrpession model

    SerializeCombined(IntPtr, IntPtr, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)

    Serialise the snapshot data to the writer and calculate the current changemask.

    Declaration
    public void SerializeCombined(IntPtr snapshot, IntPtr baseline, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    IntPtr snapshot

    Snapshot pointer

    IntPtr baseline

    Snapshot baseline

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    DataStreamWriter writer

    Datastream writer

    StreamCompressionModel compressionModel

    Compression model

    SerializeWithPredictedBaseline(IntPtr, IntPtr, IntPtr, IntPtr, ref GhostDeltaPredictor, IntPtr, int, ref DataStreamWriter, in StreamCompressionModel)

    Serialise the snapshot dato to the writer and calculate the current changemask.

    Declaration
    public void SerializeWithPredictedBaseline(IntPtr snapshot, IntPtr baseline0, IntPtr baseline1, IntPtr baseline2, ref GhostDeltaPredictor predictor, IntPtr changeMaskData, int startOffset, ref DataStreamWriter writer, in StreamCompressionModel compressionModel)
    Parameters
    Type Name Description
    IntPtr snapshot

    Snapshot pointer

    IntPtr baseline0

    Snapshot baseline

    IntPtr baseline1

    Snapshot baseline

    IntPtr baseline2

    Snapshot baseline

    GhostDeltaPredictor predictor

    Delta predicot

    IntPtr changeMaskData

    Change mask data

    int startOffset

    Start offset

    DataStreamWriter writer

    Datastream writer

    StreamCompressionModel compressionModel

    Compression model

    Implements

    IGhostSerializer

    Extension Methods

    CustomGhostSerializerHelpers.CopyBufferToSnapshot<T>(T, ArchetypeChunk, ref GhostPrefabCustomSerializer.Context, DynamicComponentTypeHandle*, in GhostCollectionComponentIndex, IntPtr, ref int, ref int)
    CustomGhostSerializerHelpers.CopyChildBufferToSnapshot<T>(T, ArchetypeChunk, int, ref GhostPrefabCustomSerializer.Context, DynamicComponentTypeHandle*, in GhostCollectionComponentIndex, IntPtr, ref int, ref int)
    CustomGhostSerializerHelpers.CopyChildComponentToSnapshot<T>(T, ArchetypeChunk, int, ref GhostPrefabCustomSerializer.Context, DynamicComponentTypeHandle*, in GhostCollectionComponentIndex, IntPtr, ref int)
    CustomGhostSerializerHelpers.CopyComponentToSnapshot<T>(T, ArchetypeChunk, ref GhostPrefabCustomSerializer.Context, DynamicComponentTypeHandle*, in GhostCollectionComponentIndex, IntPtr, ref int)
    GhostCustomSerializerExtensions.SerializeBuffer<TSerializer>(TSerializer, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, ref int, ref int, ref int, ref DataStreamWriter, in StreamCompressionModel, int)
    GhostCustomSerializerExtensions.SerializeComponentSingleBaseline<TSerializer>(TSerializer, IntPtr, in IntPtr, IntPtr, ref int, ref int, ref DataStreamWriter, in StreamCompressionModel, int)
    GhostCustomSerializerExtensions.SerializeComponentThreeBaseline<TSerializer>(TSerializer, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, ref int, ref int, ref GhostDeltaPredictor, ref DataStreamWriter, in StreamCompressionModel, int)
    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)