TryGetComponent
Retrieves the component associated with the specified Entity, if it exists. Then reports if the instance still refers to a valid entity and that it has a component of type T.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
TryGetComponent(Entity, T, bool)
Retrieves the component associated with the specified Entity, if it exists. Then reports if the instance still refers to a valid entity and that it has a component of type T.
public bool TryGetComponent(Entity entity, out T componentData, out bool entityExists)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the entity has a component of type T, and false if it does not. |
TryGetComponent(Entity, T)
Retrieves the component associated with the specified Entity, if it exists. Then reports if the instance still refers to a valid entity and that it has a component of type T.
public bool TryGetComponent(Entity entity, out T componentData)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the entity has a component of type T, and false if it does not. |