文档

Unity Engine

Download Unity

Unity Engine

HasComponent

Reports whether the specified Entity instance still refers to a valid entity and that it has a component of type T.
阅读时间1 分钟最后更新于 19 天前

Definition

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

HasComponent(Entity)

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

Parameters

entity

The entity.

Returns

Type

Description

boolTrue 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(Entity, bool)

Reports whether the specified Entity instance still refers to a valid entity and that it has a component of type T.
public bool HasComponent(Entity entity, out bool entityExists)

Parameters

entity

The entity.

entityExists

Denotes whether the given entity exists. Use to differentiate an invalid entity from the entity not having the given buffer.

Returns

Type

Description

boolTrue 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.
public bool HasComponent(SystemHandle system)

Parameters

The system handle.

Returns

Type

Description

boolTrue 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.