docs.unity.cn
    Show / Hide Table of Contents

    Method IsComponentEnabled

    IsComponentEnabled<T>(ref ComponentTypeHandle<T>, Int32)

    Checks whether a given IComponentData is enabled on the specified Entity. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

    Declaration
    public readonly bool IsComponentEnabled<T>(ref ComponentTypeHandle<T> typeHandle, int entityIndexInChunk)
        where T : IComponentData, IEnableableComponent, new()
    Parameters
    Type Name Description
    ComponentTypeHandle<T> typeHandle

    A type handle for the component type that will be queried.

    Int32 entityIndexInChunk

    The index within this chunk of the entity whose component should be checked.

    Returns
    Type Description
    Boolean

    True if the specified component is enabled, or false if it is disabled. Also returns false if the T is not present in this chunk.

    Type Parameters
    Name Description
    T

    The component type whose enabled status should be checked. This type must implement the IEnableableComponent interface.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled<T>(ref ComponentTypeHandle<T>, Int32, Boolean)

    IsComponentEnabled<T>(ComponentTypeHandle<T>, Int32)

    Obsolete. Use IsComponentEnabled<T>(ref ComponentTypeHandle<T>, Int32) instead.

    Declaration
    [Obsolete("The typeHandle argument should now be passed by ref. (RemovedAfter Entities 1.0)", false)]
    public readonly bool IsComponentEnabled<T>(ComponentTypeHandle<T> typeHandle, int entityIndexInChunk)
        where T : IComponentData, IEnableableComponent, new()
    Parameters
    Type Name Description
    ComponentTypeHandle<T> typeHandle

    A type handle for the component type that will be queried.

    Int32 entityIndexInChunk

    The index within this chunk of the entity whose component should be checked.

    Returns
    Type Description
    Boolean

    True if the specified component is enabled, or false if it is disabled. Also returns false if the T is not present in this chunk.

    Type Parameters
    Name Description
    T

    The component type whose enabled status should be checked. This type must implement the IEnableableComponent interface.

    IsComponentEnabled<T>(ref BufferTypeHandle<T>, Int32)

    Checks whether a given IBufferElementData is enabled on the specified Entity. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

    Declaration
    public readonly bool IsComponentEnabled<T>(ref BufferTypeHandle<T> bufferTypeHandle, int entityIndexInChunk)
        where T : struct, IBufferElementData, IEnableableComponent
    Parameters
    Type Name Description
    BufferTypeHandle<T> bufferTypeHandle

    A type handle for the component type that will be queried.

    Int32 entityIndexInChunk

    The index within this chunk of the entity whose component should be checked.

    Returns
    Type Description
    Boolean

    True if the specified buffer component is enabled, or false if it is disabled. Also returns false if the T is not present in this chunk.

    Type Parameters
    Name Description
    T

    The buffer component type whose enabled status should be checked. This type must implement the IEnableableComponent interface.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled<T>(ref BufferTypeHandle<T>, Int32, Boolean)

    IsComponentEnabled<T>(BufferTypeHandle<T>, Int32)

    Obsolete. Use IsComponentEnabled<T>(ref BufferTypeHandle<T>, Int32) instead.

    Declaration
    [Obsolete("The bufferTypeHandle argument should now be passed by ref. (RemovedAfter Entities 1.0)", false)]
    public readonly bool IsComponentEnabled<T>(BufferTypeHandle<T> bufferTypeHandle, int entityIndexInChunk)
        where T : struct, IBufferElementData, IEnableableComponent
    Parameters
    Type Name Description
    BufferTypeHandle<T> bufferTypeHandle

    A type handle for the component type that will be queried.

    Int32 entityIndexInChunk

    The index within this chunk of the entity whose component should be checked.

    Returns
    Type Description
    Boolean

    True if the specified buffer component is enabled, or false if it is disabled. Also returns false if the T is not present in this chunk.

    Type Parameters
    Name Description
    T

    The buffer component type whose enabled status should be checked. This type must implement the IEnableableComponent interface.

    IsComponentEnabled(ref DynamicComponentTypeHandle, Int32)

    Checks whether a given IBufferElementData is enabled on the specified Entity. For the purposes of EntityQuery matching, an entity with a disabled component will behave as if it does not have that component.

    Declaration
    public readonly bool IsComponentEnabled(ref DynamicComponentTypeHandle typeHandle, int entityIndexInChunk)
    Parameters
    Type Name Description
    DynamicComponentTypeHandle typeHandle

    A type handle for the component type that will be queried.

    Int32 entityIndexInChunk

    The index within this chunk of the entity whose component should be checked.

    Returns
    Type Description
    Boolean

    True if the specified buffer component is enabled, or false if it is disabled. Also returns false if the T is not present in this chunk.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled<T>(ref BufferTypeHandle<T>, Int32, Boolean)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023