docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct GhostPrefabCustomSerializer.Context

    Contains all the necessary data to perform the chunk serialization.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode
    Assembly: Unity.NetCode.dll
    Syntax
    public struct GhostPrefabCustomSerializer.Context

    Fields

    baselinePerEntityPtr

    The baselines to use to serialize the entities. It contains 4 baselines per entity: Index 0-2 the snapshot baseline, Index 3 the dynamic buffer baseline.

    Declaration
    [NoAlias]
    public IntPtr baselinePerEntityPtr
    Field Value
    Type Description
    IntPtr

    changeMaskOffset

    The offsets in bytes from the beginning of the snapshotDataPtr buffer where the component change mask bits bits are stored.

    Declaration
    public int changeMaskOffset
    Field Value
    Type Description
    int

    childEntityLookup

    A lookup used to retrieve the chunk information (chunk and indices) when serializing child components.

    Declaration
    [ReadOnly]
    public EntityStorageInfoLookup childEntityLookup
    Field Value
    Type Description
    EntityStorageInfoLookup

    dynamicDataCapacity

    The capacity (in bytes) of the dynamic snasphot data. This is pre-computed and it is used mostly for boundary checks.

    Declaration
    public int dynamicDataCapacity
    Field Value
    Type Description
    int

    dynamicDataOffset

    The offset from the beginning of the snapshotDynamicDataPtr from which the dynamic buffer data are going to be stored.

    Declaration
    public int dynamicDataOffset
    Field Value
    Type Description
    int

    dynamicDataSizePerEntityPtr

    [Output] a buffer that store the total size of the dynamic buffer data for each entity in the chunk.

    Declaration
    [NoAlias]
    public IntPtr dynamicDataSizePerEntityPtr
    Field Value
    Type Description
    IntPtr

    enablebBitsOffset

    The offsets in bytes from the beginning of the snapshotDataPtr buffer where the state of the component enable bits are stored.

    Declaration
    public int enablebBitsOffset
    Field Value
    Type Description
    int

    endIndex

    The index of the last relevant entity in the chunk. This should be used to iterate over the chunk entities. Don't use chunk.Count.

    Declaration
    public int endIndex
    Field Value
    Type Description
    int

    entityStartBit

    [Output] the buffer where to store the ghost data compressed size and start bit inside the temporary data stream. Stores 2 ints per component, per entity. [1st] Writer bit offset to the start of this components writes. [2nd] Num bits written for this component.

    Declaration
    [NoAlias]
    public IntPtr entityStartBit
    Field Value
    Type Description
    IntPtr

    ghostChunkComponentTypes

    The list of readonly Unity.Entities.DynamicComponentTypeHandle that must be used to retrieve the component data from the chunk

    Declaration
    [NoAlias]
    public IntPtr ghostChunkComponentTypes
    Field Value
    Type Description
    IntPtr

    ghostChunkComponentTypesPtr

    The dynamic type handle of all the registered serializable component types currently in use.

    Declaration
    [NoAlias]
    [ReadOnly]
    public IntPtr ghostChunkComponentTypesPtr
    Field Value
    Type Description
    IntPtr

    ghostChunkComponentTypesPtrLen

    The ghostChunkComponentTypesPtr list length.

    Declaration
    public int ghostChunkComponentTypesPtrLen
    Field Value
    Type Description
    int

    ghostInstances

    the pointer of the GhostInstance data in the chunk.

    Declaration
    [NoAlias]
    public IntPtr ghostInstances
    Field Value
    Type Description
    IntPtr

    ghostType

    The index inside the GhostCollectionPrefabSerializer buffer.

    Declaration
    public int ghostType
    Field Value
    Type Description
    int

    hasPreserializedData

    instruct the custom serializer to not copy the data to the snapsnot, because has been already pre-serialized

    Declaration
    public int hasPreserializedData
    Field Value
    Type Description
    int

    linkedEntityGroupTypeHandle

    Type handled used to retrieve the Unity.Entities.LinkedEntityGroup buffer from the chunk.

    Declaration
    [ReadOnly]
    public BufferTypeHandle<LinkedEntityGroup> linkedEntityGroupTypeHandle
    Field Value
    Type Description
    BufferTypeHandle<LinkedEntityGroup>

    networkId

    The connection NetworkId

    Declaration
    public int networkId
    Field Value
    Type Description
    int

    sameBaselinePerEntityPtr

    Contains a run-length encoded baseline indices to use for each entities runs. Can be used to determine if an entity is irrelevant.

    Declaration
    [NoAlias]
    public IntPtr sameBaselinePerEntityPtr
    Field Value
    Type Description
    IntPtr

    serializerState

    The GhostSerializerState data used to convert component data to snapshot data.

    Declaration
    public GhostSerializerState serializerState
    Field Value
    Type Description
    GhostSerializerState

    snapshotDataPtr

    The pointer to the buffer that contains the snapshot data. The size of the buffer is fixed by archetype, being the component set immutable after the prefab has been registered and pre-processed by the GhostCollectionSystem.

    Declaration
    [NoAlias]
    public IntPtr snapshotDataPtr
    Field Value
    Type Description
    IntPtr

    snapshotDynamicDataPtr

    The pointer to the buffer that contains the dynamic buffer snapshot data. This is a variable size buffer.

    Declaration
    [NoAlias]
    public IntPtr snapshotDynamicDataPtr
    Field Value
    Type Description
    IntPtr

    snapshotOffset

    The offset from the start of the snapshotDataPtr from which the component data are stored. The offset depends on the number of component, their change masks and the presence or not of enable bits to replicate.

    Declaration
    public int snapshotOffset
    Field Value
    Type Description
    int

    snapshotStride

    The size (in bytes) of the snasphot data. Entitiy component data are stored strided by the snapshotSize and the snapshot buffer format is something like: |ent1 | ... |ent n| |c1, c2.. cn| ... |c1, c2.. cn|

    Declaration
    public int snapshotStride
    Field Value
    Type Description
    int

    startIndex

    The index of the first relevant entity in the chunk.

    Declaration
    public int startIndex
    Field Value
    Type Description
    int

    useSingleBaseline

    instruct the custom serializer to use always a single baseline for this ghost archetype.

    Declaration
    public int useSingleBaseline
    Field Value
    Type Description
    int

    zeroBaseline

    a readonly buffer that contains all zero bytes (up to 8kb)

    Declaration
    [NoAlias]
    public IntPtr zeroBaseline
    Field Value
    Type Description
    IntPtr
    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)