docs.unity.cn
    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
    Boolean

    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.

    Remarks

    To report if the provided entity has a component of type T, this function confirms whether the EntityArchetype of the provided entity includes components of type T.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on 04 August 2022
    Terms of use