文档

Unity Engine

Download Unity

Unity Engine

HasComponent

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

Definition

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

HasComponent<T>(Entity)

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

Parameters

entity

The Entity object.

Returns

Type

Description

boolTrue, if the specified entity has the component.

Remarks

Always returns false for an entity that has been destroyed.

HasComponent<T>(SystemHandle)

Checks whether an entity associated with a system has a specific type of component.
public bool HasComponent<T>(SystemHandle system)

Parameters

The system handle.

Returns

Type

Description

boolTrue, if the specified system entity has the component.

Remarks

Always returns false for an entity that has been destroyed.

HasComponent(Entity, ComponentType)

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

Parameters

entity

The Entity object.

The data type of the component.

Returns

Type

Description

boolTrue, if the specified entity has the component.

Remarks

Always returns false for an entity that has been destroyed.

HasComponent(SystemHandle, ComponentType)

Checks whether an entity associated with a system has a specific type of component.
public bool HasComponent(SystemHandle system, ComponentType type)

Parameters

The system handle.

The data type of the component.

Returns

Type

Description

boolTrue, if the specified system entity has the component.

Remarks

Always returns false for an entity that has been destroyed.