docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method IsComponentEnabled

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

    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.

    int entityIndexInChunk

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

    Returns
    Type Description
    bool

    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>, int, bool)

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

    Obsolete. Use IsComponentEnabled<T>(ref ComponentTypeHandle<T>, int) 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.

    int entityIndexInChunk

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

    Returns
    Type Description
    bool

    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>, int)

    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 : unmanaged, IBufferElementData, IEnableableComponent
    Parameters
    Type Name Description
    BufferTypeHandle<T> bufferTypeHandle

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

    int entityIndexInChunk

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

    Returns
    Type Description
    bool

    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>, int, bool)

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

    Obsolete. Use IsComponentEnabled<T>(ref BufferTypeHandle<T>, int) 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 : unmanaged, IBufferElementData, IEnableableComponent
    Parameters
    Type Name Description
    BufferTypeHandle<T> bufferTypeHandle

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

    int entityIndexInChunk

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

    Returns
    Type Description
    bool

    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, int)

    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.

    int entityIndexInChunk

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

    Returns
    Type Description
    bool

    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>, int, bool)
    In This Article
    Back to top
    Copyright © 2024 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)