Has
Reports whether this chunk contains the specified component type.
Read time 4 minutesLast updated a day ago
Definition
- Type: Method
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
Has<T>(ComponentTypeHandle<T>)
Reports whether this chunk contains the specified component type.
public readonly bool Has<T>(ref ComponentTypeHandle<T> typeHandle) where T : struct, IComponentData
Parameters
An object containing type and job safety information. To create this object, call ComponentSystemBase.GetComponentTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains an array of the specified component type. |
Remarks
When an EntityQuery includes optional components (using EntityQueryBuilder.WithAny), some chunks returned by the query may contain such components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types.
Has<T>()
Reports whether this chunk contains the specified component type.
public readonly bool Has<T>()
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains an array of the specified component type. |
Remarks
When an EntityQuery includes optional components (using EntityQueryBuilder.WithAny), some chunks returned by the query may contain such components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types.
Has(DynamicComponentTypeHandle)
Reports whether this chunk contains the specified component type.
public readonly bool Has(ref DynamicComponentTypeHandle typeHandle)
Parameters
Type handle for the component type to query.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains an array of the specified component type. |
Has(TransformTypeHandle)
Reports whether this chunk contains the TransformRef type.
public readonly bool Has(ref TransformTypeHandle typeHandle)
Parameters
Type handle for the transform type.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains an array of transform component type. |
Has<T>(SharedComponentTypeHandle<T>)
Reports whether this chunk contains a shared component of the specified component type.
public readonly bool Has<T>(SharedComponentTypeHandle<T> typeHandle) where T : struct, ISharedComponentData
Parameters
An object containing type and job safety information. To create this object, call ComponentSystemBase.GetSharedComponentTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains a shared component of the specified type. |
Remarks
When an EntityQuery includes optional components used as shared components (with EntityQueryBuilder.WithAny), some chunks returned by the query may have these shared components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a shared component.
Has(DynamicSharedComponentTypeHandle)
Reports whether this chunk contains a shared component of the specified component type.
public readonly bool Has(ref DynamicSharedComponentTypeHandle typeHandle)
Parameters
An object containing type and job safety information. To create this object, call ComponentSystemBase.GetDynamicSharedComponentTypeHandle.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains a shared component of the specified type. |
Remarks
When an EntityQuery includes optional components used as shared components (with EntityQueryBuilder.WithAny), some chunks returned by the query may have these shared components and some may not. Use this function to determine whether or not the current chunk contains one of these optional component types as a shared component.
Has<T>(BufferTypeHandle<T>)
Reports whether this chunk contains a dynamic buffer containing the specified component type.
public readonly bool Has<T>(ref BufferTypeHandle<T> bufferTypeHandle) where T : unmanaged, IBufferElementData
Parameters
An object containing type and job safety information. To create this object, call ComponentSystemBase.GetBufferTypeHandle. Pass the object to a job using a public field you define as part of the job struct.
Returns
Type | Description |
|---|---|
| bool | True, if this chunk contains an array of the dynamic buffers containing the specified component type. |
Remarks
When an EntityQuery includes optional dynamic buffer types (with EntityQueryBuilder.WithAny), some chunks returned by the query may have these dynamic buffers components and some may not. Use this function to determine whether or not the current chunk contains one of these optional dynamic buffers.