docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method IsComponentEnabled

    IsComponentEnabled<T>(Entity)

    Checks whether a given ComponentType is enabled on the specified Entity.

    Declaration
    public bool IsComponentEnabled<T>(Entity entity) where T : IEnableableComponent
    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.

    Type Parameters
    Name Description
    T

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

    Remarks

    An entity with a disabled component will not match an EntityQuery that requires that component, and will match a query that excludes that component.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled<T>(Entity, bool)
    IsComponentEnabled(Entity)

    IsComponentEnabled<T>(SystemHandle)

    Checks whether a given ComponentType is enabled on the specified system using SystemHandle.

    Declaration
    public bool IsComponentEnabled<T>(SystemHandle systemHandle) where T : IEnableableComponent
    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.

    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 SystemHandle does not exist.

    See Also
    SetComponentEnabled<T>(SystemHandle, bool)
    IsComponentEnabled(SystemHandle)

    IsComponentEnabled(Entity, ComponentType)

    Checks whether a given ComponentType is enabled on the specified Entity.

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

    The entity whose component should be checked.

    ComponentType componentType

    The component type to enable or disable. This type must implement the IEnableableComponent interface.

    Returns
    Type Description
    bool

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

    Remarks

    An entity with a disabled component will not match an EntityQuery that requires that component, and will match a query that excludes that component.

    Exceptions
    Type Condition
    ArgumentException

    The Entity does not exist.

    See Also
    SetComponentEnabled(Entity, ComponentType, bool)
    IsComponentEnabled(Entity)
    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)