docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method HasComponent

    HasComponent(Entity)

    Reports whether the specified Entity instance still refers to a valid entity and that it has a component of type T.

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

    The entity.

    Returns
    Type Description
    bool

    True if the entity has a component of type T, and false if it does not. Also returns false if the Entity instance refers to an entity that has been destroyed.

    HasComponent(SystemHandle)

    Reports whether the specified SystemHandle associated Entity is valid and contains a component of type T.

    Declaration
    public bool HasComponent(SystemHandle system)
    Parameters
    Type Name Description
    SystemHandle system

    The system handle.

    Returns
    Type Description
    bool

    True if the entity associated with the system has a component of type T, and false if it does not. Also returns false if the system handle refers to a system that has been destroyed.

    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)