文档

Unity Engine

Unity Engine

HasComponent

Checks whether an entity has a specific type of component.
阅读时间1 分钟最后更新于 1 天前

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.