docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct GhostPrefabCreation.Config

    Configuration used to create a ghost prefab.

    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 GhostPrefabCreation.Config

    Fields

    CollectComponentFunc

    Optional, custom deterministic function that retrieves all no-backing and serializable component types for this ghost. Serializable means components that either have ghost fields (fields with a GhostFieldAttribute attribute) or a GhostComponentAttribute.

    Declaration
    public PortableFunctionPointer<GhostPrefabCustomSerializer.CollectComponentDelegate> CollectComponentFunc
    Field Value
    Type Description
    PortableFunctionPointer<GhostPrefabCustomSerializer.CollectComponentDelegate>

    DefaultGhostMode

    The default mode for this ghost. This controls what the prefab will be instantiated as when the client spawns it, but the default can be overridden and the mode can be changed at runtime.

    Declaration
    public GhostMode DefaultGhostMode
    Field Value
    Type Description
    GhostMode

    FullTickSmoothing

    Ghosts that only move on full ticks don't move on frames that fall between two ticks, which shows as jitter when the render rate is above the SimulationTickRate. Enabling this interpolates the ghost's rendered transform (Unity.Transforms.LocalToWorld) between the last two full ticks, while the simulated transform (Unity.Transforms.LocalTransform, Position, what your GhostBehaviours see) stays tick accurate. Disabled by default. Applies to:

    • Every instance of this ghost on a single-world host (hosts never run partial ticks).
    • Predicted instances on clients when PartialTickModeSelection is FullTicksOnly. With partial ticks enabled, prediction already moves the ghost every frame and this has no effect.
    Both go through the NetcodeFullTickSmoothLocalToWorld component.
    Declaration
    public FullTickSmoothingMode FullTickSmoothing
    Field Value
    Type Description
    FullTickSmoothingMode
    Remarks

    Interpolating introduces roughly half a tick of render latency on average, in a mechanism similar to the interpolation window in binary worlds. On clients, server corrections are blended in over the following tick like any other movement (teleports further than the smoothing distance snap), and this stacks with prediction error smoothing (GhostPredictionSmoothing): that one spreads a correction across ticks, this one smooths the frames in between ticks.

    Importance

    Higher importance means the ghost will be sent more frequently if there is not enough bandwidth to send everything. Minimum value: 1.

    Declaration
    public int Importance
    Field Value
    Type Description
    int

    MaxSendRate

    Denotes the max send frequency of a ghost, similar to MinSendImportance.

    Declaration
    public byte MaxSendRate
    Field Value
    Type Description
    byte

    Name

    The name of the ghost. When creating prefabs from code this is used to create a unique ghost type.

    Declaration
    public FixedString64Bytes Name
    Field Value
    Type Description
    FixedString64Bytes

    OptimizationMode

    Dynamic optimization mode uses multiple baselines to make sure data is always small. Static optimization mode will compress slightly less when there are changes, but it will have zero cost when there are no changes.

    Declaration
    public GhostOptimizationMode OptimizationMode
    Field Value
    Type Description
    GhostOptimizationMode

    PredictedSpawnedGhostRollbackToSpawnTick

    Enable predicted spawned ghost to rollback their initial spawn state and re-predict until the authoritative spawn has been received from the server.

    Declaration
    public bool PredictedSpawnedGhostRollbackToSpawnTick
    Field Value
    Type Description
    bool

    RollbackPredictionOnStructuralChanges

    Client CPU optimization. Force predicted ghost to always try to continue from the last prediction in case of structural changes. True by default (because may introduce some issue when replicated component are removed).

    Declaration
    public bool RollbackPredictionOnStructuralChanges
    Field Value
    Type Description
    bool

    SnapshotHistorySize

    The number of snapshot history slots to store for this ghost type. 0 (the default) uses the global SnapshotHistorySize (driven by the NETCODE_SNAPSHOT_HISTORY_SIZE_* scripting defines); any other value is used as-is, though clamped to MinSnapshotHistorySize and MaxSnapshotHistorySize. Lower values save memory on both client and server at the cost of weaker delta-compression; see CalculateRecommendedSnapshotHistorySize(byte, in ClientServerTickRate) for a recommended value based on MaxSendRate.

    Declaration
    public byte SnapshotHistorySize
    Field Value
    Type Description
    byte

    SupportedGhostModes

    The ghost modes this prefab can be instantiated as. If for example set the Interpolated it is not possible to use this prefab for prediction.

    Declaration
    public GhostModeMask SupportedGhostModes
    Field Value
    Type Description
    GhostModeMask

    UUID5GhostType

    Optional UUID5 identifier used to unique determine the ghost type. By default that ghost type of the generated prefab is calculated using the SHA1 hash of the mandatory Name property (combined with some unique GUID prefix). If user provide a non-default ghost unique UUID5 guid the ghost will use that instead.

    Declaration
    public Hash128 UUID5GhostType
    Field Value
    Type Description
    Hash128

    UsePreSerialization

    Enable pre-serialization for this ghost. Pre-serialization makes it possible to share part of the serialization cpu cost between connections, but it also has that cost when the ghost is not sent.

    Declaration
    public bool UsePreSerialization
    Field Value
    Type Description
    bool

    UseSingleBaseline

    Instruct the GhostSendSystem to always use a single baseline for this ghost archetype.

    Declaration
    public bool UseSingleBaseline
    Field Value
    Type Description
    bool
    In This Article
    Back to top
    Copyright © 2026 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)