docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct PredictedGhostSpawnRequest

    Optional component, used to request predictive spawn of a ghosts by the client. The component is automatically added to the authored ghost prefabs when:
    - The baking target is Client or ClientAndServer.
    - When using the hybrid authoring workflow, if the GhostAuthoringComponent.SuypportedGhostModes is Predicted or All.
    - When using the ConvertToGhostPrefab(EntityManager, Entity, Config, NativeParallelHashMap<Component, ComponentOverride>), if the SupportedGhostModes is set to Predicted or All.

    The component enable state is initialized as disabled. Therefore, all queries like `WithAll` will not find this component. In case you need to check for presence of the component (rare if not ever needed) please use `WithDisabled` or `WithPresent` instead.

    The PredictedGhostSpawnSystem is in charge of consuming the request and initilize the ghost snapshot buffer with the current state of the ghost and it spawn tick.

    • the enable state of the component is changed to `Enabled` after the ghost has been initialized.
    • the removal of the component is scheduled inside the `BeginSimulationCommandBufferSystem` and will be executed the next frame.
    The component is temporarily enabled before it is going to be removed (beginning of the next frame) to avoid re-initializing the ghost state multiple times. This situation is possible because the PredictedGhostSpawnSystem is also updated inside the prediction loop (see PredictedSpawningSystemGroup), potentially multiple times per frame.

    The package provides a default handling for predictive spawning (DefaultGhostSpawnClassificationSystem). In case you need a custom or more accurate way to match the predicted spawned entities with the authoritive server spawned ones, you can implement a custom spawn classification system. See GhostSpawnClassificationSystem for further details.

    Implements
    IComponentData
    IQueryTypeParameter
    IEnableableComponent
    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 PredictedGhostSpawnRequest : IComponentData, IQueryTypeParameter, IEnableableComponent

    Implements

    IComponentData
    IQueryTypeParameter
    IEnableableComponent
    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)