docs.unity3d.com
    Show / Hide Table of Contents

    Struct SnapshotDataBufferComponentLookup

    Helper struct that can be used to inspect the presence of components from a SnapshotData buffer and retrieve their data. The lookup can be passed ot jobs The helper allow to only read component data. Buffers are not supported.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.NetCode.LowLevel
    Syntax
    public struct SnapshotDataBufferComponentLookup

    Methods

    GetFallbackPredictionMode(in GhostSpawnBuffer)

    Retrieve the prediction mode used as fallback if the spawning ghost has not been classified.

    Declaration
    public GhostSpawnBuffer.Type GetFallbackPredictionMode(in GhostSpawnBuffer ghost)
    Parameters
    Type Name Description
    GhostSpawnBuffer ghost
    Returns
    Type Description
    GhostSpawnBuffer.Type

    The fallback mode to use

    GetGhostOwner(in GhostSpawnBuffer, in DynamicBuffer<SnapshotDataBuffer>)

    Retrieve the network id of the player owning the ghost if the ghost archetype has a GhostOwner.

    Declaration
    public int GetGhostOwner(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> data)
    Parameters
    Type Name Description
    GhostSpawnBuffer ghost
    DynamicBuffer<SnapshotDataBuffer> data
    Returns
    Type Description
    Int32

    the id of the player owning the ghost, if the GhostOwner is present, 0 otherwise.

    HasBuffer<T>(Int32)

    Check if the a component of type T is present this spawning ghost.

    Declaration
    public bool HasBuffer<T>(int ghostTypeIndex)
        where T : struct, IBufferElementData
    Parameters
    Type Name Description
    Int32 ghostTypeIndex

    The index in the Unity.NetCode.GhostCollectionPrefabSerializer collection

    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    HasComponent<T>(Int32)

    Check if the a component of type T is present this spawning ghost.

    Declaration
    public bool HasComponent<T>(int ghostTypeIndex)
        where T : struct, IComponentData
    Parameters
    Type Name Description
    Int32 ghostTypeIndex

    The index in the Unity.NetCode.GhostCollectionPrefabSerializer collection

    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    HasGhostOwner(in GhostSpawnBuffer)

    Check if the spawning ghost has a GhostOwner.

    Declaration
    public bool HasGhostOwner(in GhostSpawnBuffer ghost)
    Parameters
    Type Name Description
    GhostSpawnBuffer ghost
    Returns
    Type Description
    Boolean

    True if the spawning ghost is owner predicted

    IsOwnerPredicted(in GhostSpawnBuffer)

    Check if the spawning ghost mode is owner predicted.

    Declaration
    public bool IsOwnerPredicted(in GhostSpawnBuffer ghost)
    Parameters
    Type Name Description
    GhostSpawnBuffer ghost
    Returns
    Type Description
    Boolean

    True if the spawning ghost is owner predicted

    TryGetComponentDataFromSnapshotHistory<T>(Int32, in DynamicBuffer<SnapshotDataBuffer>, out T, Int32)

    Try to retrieve the data for a component type from the the snapshot history buffer.

    Declaration
    public bool TryGetComponentDataFromSnapshotHistory<T>(int ghostTypeIndex, in DynamicBuffer<SnapshotDataBuffer> snapshotBuffer, out T componentData, int slotIndex = 0)
        where T : struct, IComponentData
    Parameters
    Type Name Description
    Int32 ghostTypeIndex

    The index in the Unity.NetCode.GhostCollectionPrefabSerializer collection.

    DynamicBuffer<SnapshotDataBuffer> snapshotBuffer

    The entity snapshot history buffer.

    T componentData

    The deserialized component data.

    Int32 slotIndex

    The slot in the history buffer to use.

    Returns
    Type Description
    Boolean

    True if the component is present and the component data is initialized. False otherwise

    Type Parameters
    Name Description
    T
    Remarks

    Buffers aren't supported.

    Only component present on the root entity can be retrieved. Trying to get data for component in a child entity is not supported.

    TryGetComponentDataFromSpawnBuffer<T>(in GhostSpawnBuffer, in DynamicBuffer<SnapshotDataBuffer>, out T)

    Try to retrieve the data for a component type from the spawning buffer.

    Declaration
    public bool TryGetComponentDataFromSpawnBuffer<T>(in GhostSpawnBuffer ghost, in DynamicBuffer<SnapshotDataBuffer> snapshotData, out T componentData)
        where T : struct, IComponentData
    Parameters
    Type Name Description
    GhostSpawnBuffer ghost
    DynamicBuffer<SnapshotDataBuffer> snapshotData
    T componentData
    Returns
    Type Description
    Boolean

    True if the component is present and the component data is initialized. False otherwise

    Type Parameters
    Name Description
    T
    Remarks

    Buffers aren't supported.

    Only component present on the root entity can be retrieved. Trying to get data for component in a child entity is not supported.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023