docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method IsComponentEnabled

    IsComponentEnabled(Entity)

    Checks whether the IComponentData of type T 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. The type T must implement the IEnableableComponent interface.

    Declaration
    public bool IsComponentEnabled(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The entity whose component should be checked.

    Returns
    Type Description
    bool

    True if the specified component is enabled, or false if it is disabled.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled(Entity, bool)

    IsComponentEnabled(SystemHandle)

    Checks whether the IComponentData of type T is enabled on the specified system using a SystemHandle. For the purposes of EntityQuery matching, a system with a disabled component will behave as if it does not have that component. The type T must implement the IEnableableComponent interface.

    Declaration
    public bool IsComponentEnabled(SystemHandle systemHandle)
    Parameters
    Type Name Description
    SystemHandle systemHandle

    The system whose component should be checked.

    Returns
    Type Description
    bool

    True if the specified component is enabled, or false if it is disabled.

    Exceptions
    Type Condition
    ArgumentException

    The SystemHandle does not exist.

    See Also
    SetComponentEnabled(SystemHandle, 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)