Documentation

Unity Engine

Download Unity

Unity Engine

HasComponent

Checks whether an entity has a specific type of component.
Read time 1 minuteLast updated a day ago

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule

HasComponent<T>(Entity)

Checks whether an entity has a specific type of component.
public static bool HasComponent<T>(Entity entity)

Parameters

entity

The entity.

Returns

Type

Description

boolTrue if the entity exists and has the component.

HasComponent(Entity, ComponentType)

Checks whether an entity has a specific type of component.
public static bool HasComponent(Entity entity, ComponentType type)

Parameters

entity

The entity.

The component type.

Returns

Type

Description

boolTrue if the entity exists and has the component.