HasComponent
Checks whether an entity has a specific type of component.
Read time 1 minuteLast updated 4 days ago
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
The Entity object.
Returns
Type | Description |
|---|---|
| bool | True, 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 |
|---|---|
| bool | True, 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
Returns
Type | Description |
|---|---|
| bool | True, 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
Returns
Type | Description |
|---|---|
| bool | True, if the specified system entity has the component. |
Remarks
Always returns false for an entity that has been destroyed.