docs.unity.cn
    Show / Hide Table of Contents

    Method Has

    Has<T>(ComponentTypeHandle<T>)

    Reports whether this chunk contains the specified component type.

    Declaration
    public bool Has<T>(ComponentTypeHandle<T> chunkComponentTypeHandle)
        where T : IComponentData
    Parameters
    Type Name Description
    ComponentTypeHandle<T> chunkComponentTypeHandle

    An object containing type and job safety information. Create this object by calling GetComponentTypeHandle<T>(Boolean) immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.

    Returns
    Type Description
    Boolean

    True, if this chunk contains an array of the specified component type.

    Type Parameters
    Name Description
    T

    The data type of the component.

    Remarks

    When an EntityQuery includes optional components (using Any), some chunks returned by the query may contain such components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types.

    Has(DynamicComponentTypeHandle)

    Declaration
    public bool Has(DynamicComponentTypeHandle chunkComponentType)
    Parameters
    Type Name Description
    DynamicComponentTypeHandle chunkComponentType
    Returns
    Type Description
    Boolean

    Has<T>(SharedComponentTypeHandle<T>)

    Reports whether this chunk contains a shared component of the specified component type.

    Declaration
    public bool Has<T>(SharedComponentTypeHandle<T> chunkComponentTypeHandle)
        where T : struct, ISharedComponentData
    Parameters
    Type Name Description
    SharedComponentTypeHandle<T> chunkComponentTypeHandle

    An object containing type and job safety information. Create this object by calling GetSharedComponentTypeHandle<T>() immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.

    Returns
    Type Description
    Boolean

    True, if this chunk contains a shared component of the specified type.

    Type Parameters
    Name Description
    T

    The data type of the shared component.

    Remarks

    When an EntityQuery includes optional components used as shared components (with Any), some chunks returned by the query may have these shared components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a shared component.

    Has(DynamicSharedComponentTypeHandle)

    Reports whether this chunk contains a shared component of the specified component type.

    Declaration
    public bool Has(DynamicSharedComponentTypeHandle chunkComponentTypeHandle)
    Parameters
    Type Name Description
    DynamicSharedComponentTypeHandle chunkComponentTypeHandle

    An object containing type and job safety information. Create this object by calling GetDynamicSharedComponentTypeHandle(ComponentType).

    Returns
    Type Description
    Boolean

    True, if this chunk contains a shared component of the specified type.

    Remarks

    When an EntityQuery includes optional components used as shared components (with Any), some chunks returned by the query may have these shared components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a shared component.

    Has<T>(BufferTypeHandle<T>)

    Reports whether this chunk contains a dynamic buffer containing the specified component type.

    Declaration
    public bool Has<T>(BufferTypeHandle<T> chunkBufferTypeHandle)
        where T : struct, IBufferElementData
    Parameters
    Type Name Description
    BufferTypeHandle<T> chunkBufferTypeHandle

    An object containing type and job safety information. Create this object by calling GetBufferTypeHandle<T>(Boolean) immediately before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.

    Returns
    Type Description
    Boolean

    True, if this chunk contains an array of the dynamic buffers containing the specified component type.

    Type Parameters
    Name Description
    T

    The data type of the component stored in the dynamic buffer.

    Remarks

    When an EntityQuery includes optional dynamic buffer types (with Any), some chunks returned by the query may have these dynamic buffers components and some may not. Use this function to determine whether or not the current chunk contains one of these optional dynamic buffers.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Wednesday, July 6, 2022
    Terms of use