docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct GhostCollectionPrefabSerializer

    A list of all serializer data for the prefabs in GhostCollectionPrefab. This list can be shorter if not all serializers are created yet. Added to the GhostCollection singleton entity.

    Implements
    IBufferElementData
    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
    [InternalBufferCapacity(0)]
    public struct GhostCollectionPrefabSerializer : IBufferElementData

    Fields

    BaseImportance

    Reflect the importance value set in the GhostAuthoringComponent. Is used as the base value for the scaled importance calculated at runtime.

    Declaration
    public int BaseImportance
    Field Value
    Type Description
    int

    ChangeMaskBits

    The number of bits used by change mask bitarray for this entire ghost type.

    Declaration
    public int ChangeMaskBits
    Field Value
    Type Description
    int

    CustomPreSerializer

    The function pointer to invoke for pre-serializing the chunk (only for server).

    Declaration
    public PortableFunctionPointer<GhostPrefabCustomSerializer.ChunkPreserializeDelegate> CustomPreSerializer
    Field Value
    Type Description
    PortableFunctionPointer<GhostPrefabCustomSerializer.ChunkPreserializeDelegate>

    CustomSerializer

    A custom serializer function to serializer the chunk (only for server).

    Declaration
    public PortableFunctionPointer<GhostPrefabCustomSerializer.ChunkSerializerDelegate> CustomSerializer
    Field Value
    Type Description
    PortableFunctionPointer<GhostPrefabCustomSerializer.ChunkSerializerDelegate>

    EnableableBits

    The number of bits necessary to store the enabled state of all the enableable ghost components (that are flagged with GhostEnabledBitAttribute).

    Declaration
    public int EnableableBits
    Field Value
    Type Description
    int

    FallbackPredictionMode

    Used by the GhostSpawnClassificationSystem to assign the type of GhostSpawnBuffer.Type to use for this ghost, if no other user-defined system has classified how the new ghost should be spawned.

    Declaration
    public GhostSpawnBuffer.Type FallbackPredictionMode
    Field Value
    Type Description
    GhostSpawnBuffer.Type

    FirstComponent

    The index of the first component serialization rule to use inside the GhostCollectionComponentIndex.

    Declaration
    public int FirstComponent
    Field Value
    Type Description
    int

    IsGhostGroup

    Flag that indicates if the ghost prefab contains a GhostGroup component and can be used as root of the group (see also GhostChildEntity).

    Declaration
    public int IsGhostGroup
    Field Value
    Type Description
    int

    MaxBufferSnapshotSize

    The size of the largest replicated IBufferElementData for this ghost. It is used to calculate the necessary SnapshotDynamicDataBuffer capacity to hold the replicated buffer data.

    Declaration
    public int MaxBufferSnapshotSize
    Field Value
    Type Description
    int

    NumBuffers

    The total number of replicated IBufferElementData for this ghost.

    Declaration
    public int NumBuffers
    Field Value
    Type Description
    int

    NumChildComponents

    The total number of serialized components present only in the child entities.

    Declaration
    public int NumChildComponents
    Field Value
    Type Description
    int

    NumComponents

    The total number of serialized components. Include both root and child entities.

    Declaration
    public int NumComponents
    Field Value
    Type Description
    int

    OwnerPredicted

    Flag stating if the ghost replication mode is set to owner predicted.

    Declaration
    public int OwnerPredicted
    Field Value
    Type Description
    int

    PartialComponents

    Set to 1 when the ghost contains components with different GhostComponentSerializer.SendMask. Based on the ghost replication mode (interpolated or predicted), some of these component should be not replicated, and the decision must be made by the GhostSendSystem at runtime, when entities are serialized.

    Declaration
    public byte PartialComponents
    Field Value
    Type Description
    byte

    PartialSendToOwner

    Set to 1 if the ghost has some components for which the OwnerSendType is different than All. When the flag is set, the GhostSendSystem will peform the necessary ghost owner checks.

    Declaration
    public byte PartialSendToOwner
    Field Value
    Type Description
    byte

    PredictionOwnerOffset

    Only set if the GhostOwner is present on the entity prefab, is the offset in bytes, from the beginning of the snapshot data, in which the network id of the of client owning the entity can be retrieved.

    var ghostOwner = *(uint*)(snapshotDataPtr + PredictionOwnerOffset)
    Declaration
    public int PredictionOwnerOffset
    Field Value
    Type Description
    int

    SnapshotSize

    The total size in bytes of the entire ghost type, including space for enable bits and change masks.

    Declaration
    public int SnapshotSize
    Field Value
    Type Description
    int

    StaticOptimization

    True if the GhostOptimizationMode is set to Static in the GhostAuthoringComponent.

    Declaration
    public byte StaticOptimization
    Field Value
    Type Description
    byte

    TypeHash

    The stable type hash of the prefab. Used to retrieve GhostCollectionPrefabSerializer instance. The hash is composed by the name and the hash of all the component serializers.

    Declaration
    public ulong TypeHash
    Field Value
    Type Description
    ulong

    profilerMarker

    A profile marker used to track serialization performance.

    Declaration
    public ProfilerMarker profilerMarker
    Field Value
    Type Description
    ProfilerMarker

    Implements

    IBufferElementData
    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)