Struct ArchetypeChunk
A block of unmanaged memory containing the components for entities sharing the same
Unity.Entities.Archetype.
Syntax
public struct ArchetypeChunk : IEquatable<ArchetypeChunk>
Properties
Archetype
The archetype of the entities stored in this chunk.
Declaration
public readonly EntityArchetype Archetype { get; }
Property Value
Capacity
The number of entities that can fit in this chunk.
Declaration
public readonly int Capacity { get; }
Property Value
Count
The number of entities currently stored in the chunk.
Declaration
public readonly int Count { get; }
Property Value
Full
Whether this chunk is exactly full.
Declaration
public readonly bool Full { get; }
Property Value
Null
A special "null" ArchetypeChunk that you can use to test whether ArchetypeChunk instances are valid.
Declaration
public static readonly ArchetypeChunk Null { get; }
Property Value
Methods
DidChange<T>(ArchetypeChunkBufferType<T>, UInt32)
Reports whether any of dynamic buffer components in the chunk, of the type identified by
chunkBufferType
, could have changed.
Declaration
public bool DidChange<T>(ArchetypeChunkBufferType<T> chunkBufferType, uint version)
where T : struct, IBufferElementData
Parameters
Type |
Name |
Description |
ArchetypeChunkBufferType<T> |
chunkBufferType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
UInt32 |
version |
The version to compare. In a system, this parameter should be set to the
current LastSystemVersion at the time the job is run or
scheduled.
|
Returns
Type |
Description |
Boolean |
True, if the version number stored in the chunk for this component is more recent than the version
passed to the version parameter.
|
Type Parameters
Name |
Description |
T |
The data type of the elements in the dynamic buffer.
|
DidChange<T>(ArchetypeChunkComponentType<T>, UInt32)
Reports whether any of IComponentData components in the chunk, of the type identified by
chunkComponentType
, could have changed.
Declaration
public bool DidChange<T>(ArchetypeChunkComponentType<T> chunkComponentType, uint version)
where T : IComponentData
Parameters
Type |
Name |
Description |
ArchetypeChunkComponentType<T> |
chunkComponentType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
UInt32 |
version |
The version to compare. In a system, this parameter should be set to the
current LastSystemVersion at the time the job is run or
scheduled.
|
Returns
Type |
Description |
Boolean |
True, if the version number stored in the chunk for this component is more recent than the version
passed to the version parameter.
|
Type Parameters
Name |
Description |
T |
The component type.
|
DidChange<T>(ArchetypeChunkSharedComponentType<T>, UInt32)
Declaration
public bool DidChange<T>(ArchetypeChunkSharedComponentType<T> chunkSharedComponentData, uint version)
where T : struct, ISharedComponentData
Parameters
Returns
Type Parameters
Equals(Object)
Two ArchetypeChunk instances are equal if they reference the same block of chunk memory.
Declaration
public override bool Equals(object compare)
Parameters
Type |
Name |
Description |
Object |
compare |
An object
|
Returns
Type |
Description |
Boolean |
True if compare is an ArchetypeChunk instance that references the same memory,
or both contain null memory references; otherwise false.
|
Overrides
Equals(ArchetypeChunk)
Two ArchetypeChunk instances are equal if they reference the same block of chunk memory.
Declaration
public bool Equals(ArchetypeChunk archetypeChunk)
Parameters
Type |
Name |
Description |
ArchetypeChunk |
archetypeChunk |
Another ArchetypeChunk instance
|
Returns
Type |
Description |
Boolean |
True, if both ArchetypeChunk instances reference the same memory or both contain null memory
references.
|
GetBufferAccessor<T>(ArchetypeChunkBufferType<T>)
Declaration
public BufferAccessor<T> GetBufferAccessor<T>(ArchetypeChunkBufferType<T> bufferComponentType)
where T : struct, IBufferElementData
Parameters
Returns
Type Parameters
GetChunkComponentData<T>(ArchetypeChunkComponentType<T>)
Declaration
public T GetChunkComponentData<T>(ArchetypeChunkComponentType<T> chunkComponentType)
where T : struct
Parameters
Returns
Type Parameters
GetComponentObjects<T>(ArchetypeChunkComponentType<T>, EntityManager)
Declaration
public ArchetypeChunkComponentObjects<T> GetComponentObjects<T>(ArchetypeChunkComponentType<T> componentType, EntityManager manager)
where T : class
Parameters
Returns
Type Parameters
GetComponentVersion<T>(ArchetypeChunkBufferType<T>)
Declaration
public uint GetComponentVersion<T>(ArchetypeChunkBufferType<T> chunkBufferType)
where T : struct, IBufferElementData
Parameters
Returns
Type Parameters
GetComponentVersion<T>(ArchetypeChunkComponentType<T>)
Declaration
public uint GetComponentVersion<T>(ArchetypeChunkComponentType<T> chunkComponentType)
where T : IComponentData
Parameters
Returns
Type Parameters
GetComponentVersion<T>(ArchetypeChunkSharedComponentType<T>)
Declaration
public uint GetComponentVersion<T>(ArchetypeChunkSharedComponentType<T> chunkSharedComponentData)
where T : struct, ISharedComponentData
Parameters
Returns
Type Parameters
GetDynamicComponentDataArrayReinterpret<T>(ArchetypeChunkComponentTypeDynamic, Int32)
Declaration
public NativeArray<T> GetDynamicComponentDataArrayReinterpret<T>(ArchetypeChunkComponentTypeDynamic chunkComponentType, int expectedTypeSize)
where T : struct
Parameters
Returns
Type Parameters
Exceptions
GetHashCode()
Computes a hashcode to support hash-based collections.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
Int32 |
The computed hash.
|
Overrides
GetNativeArray(ArchetypeChunkEntityType)
Provides a native array interface to entity instances stored in this chunk.
Declaration
public NativeArray<Entity> GetNativeArray(ArchetypeChunkEntityType archetypeChunkEntityType)
Parameters
Type |
Name |
Description |
ArchetypeChunkEntityType |
archetypeChunkEntityType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
NativeArray<Entity> |
A native array containing the entities in the chunk.
|
GetNativeArray<T>(ArchetypeChunkComponentType<T>)
Provides a native array interface to components stored in this chunk.
Declaration
public NativeArray<T> GetNativeArray<T>(ArchetypeChunkComponentType<T> chunkComponentType)
where T : struct, IComponentData
Parameters
Type |
Name |
Description |
ArchetypeChunkComponentType<T> |
chunkComponentType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
NativeArray<T> |
A native array containing the components in the chunk.
|
Type Parameters
Name |
Description |
T |
The data type of the component.
|
Exceptions
Type |
Condition |
ArgumentException |
If you call this function on a "tag" component type (which is an empty
component with no fields).
|
GetSharedComponentData<T>(ArchetypeChunkSharedComponentType<T>, EntityManager)
Declaration
public T GetSharedComponentData<T>(ArchetypeChunkSharedComponentType<T> chunkSharedComponentData, EntityManager entityManager)
where T : struct, ISharedComponentData
Parameters
Returns
Type Parameters
GetSharedComponentIndex<T>(ArchetypeChunkSharedComponentType<T>)
Declaration
public int GetSharedComponentIndex<T>(ArchetypeChunkSharedComponentType<T> chunkSharedComponentData)
where T : struct, ISharedComponentData
Parameters
Returns
Type Parameters
Has(ArchetypeChunkComponentTypeDynamic)
Declaration
public bool Has(ArchetypeChunkComponentTypeDynamic chunkComponentType)
Parameters
Returns
Has<T>(ArchetypeChunkBufferType<T>)
Reports whether this chunk contains a dynamic buffer containing the specified component type.
Declaration
public bool Has<T>(ArchetypeChunkBufferType<T> chunkBufferType)
where T : struct, IBufferElementData
Parameters
Type |
Name |
Description |
ArchetypeChunkBufferType<T> |
chunkBufferType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
Boolean |
True, if this chunk contains an array of the dynamic buffers containing the specified component type.
|
Type Parameters
Name |
Description |
T |
The data type of the component stored in the dynamic buffer.
|
Has<T>(ArchetypeChunkComponentType<T>)
Reports whether this chunk contains the specified component type.
Declaration
public bool Has<T>(ArchetypeChunkComponentType<T> chunkComponentType)
where T : IComponentData
Parameters
Type |
Name |
Description |
ArchetypeChunkComponentType<T> |
chunkComponentType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
Boolean |
True, if this chunk contains an array of the specified component type.
|
Type Parameters
Name |
Description |
T |
The data type of the component.
|
Has<T>(ArchetypeChunkSharedComponentType<T>)
Reports whether this chunk contains a shared component of the specified component type.
Declaration
public bool Has<T>(ArchetypeChunkSharedComponentType<T> chunkComponentType)
where T : struct, ISharedComponentData
Parameters
Type |
Name |
Description |
ArchetypeChunkSharedComponentType<T> |
chunkComponentType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
Boolean |
True, if this chunk contains a shared component of the specified type.
|
Type Parameters
Name |
Description |
T |
The data type of the shared component.
|
HasChunkComponent<T>(ArchetypeChunkComponentType<T>)
Reports whether this chunk contains a chunk component of the specified component type.
Declaration
public bool HasChunkComponent<T>(ArchetypeChunkComponentType<T> chunkComponentType)
where T : struct, IComponentData
Parameters
Type |
Name |
Description |
ArchetypeChunkComponentType<T> |
chunkComponentType |
An object containing type and job safety information. Create this
object by calling immediately
before scheduling a job. Pass the object to a job using a public field you define as part of the job struct.
|
Returns
Type |
Description |
Boolean |
True, if this chunk contains a chunk component of the specified type.
|
Type Parameters
Name |
Description |
T |
The data type of the chunk component.
|
Invalid()
Reports whether this ArchetypeChunk instance is invalid.
Declaration
Returns
Type |
Description |
Boolean |
True, if no Unity.Entities.Archetype is associated with the this ArchetypeChunk
instance.
|
Locked()
Reports whether this ArchetypeChunk is locked.
Declaration
Returns
Type |
Description |
Boolean |
True, if locked.
|
See Also
NumSharedComponents()
The number of shared components in the archetype associated with this chunk.
Declaration
public int NumSharedComponents()
Returns
Type |
Description |
Int32 |
The shared component count.
|
SetChunkComponentData<T>(ArchetypeChunkComponentType<T>, T)
Declaration
public void SetChunkComponentData<T>(ArchetypeChunkComponentType<T> chunkComponentType, T value)
where T : struct
Parameters
Type Parameters
Operators
Equality(ArchetypeChunk, ArchetypeChunk)
Two ArchetypeChunk instances are equal if they reference the same block of chunk memory.
Declaration
public static bool operator ==(ArchetypeChunk lhs, ArchetypeChunk rhs)
Parameters
Returns
Type |
Description |
Boolean |
True, if both ArchetypeChunk instances reference the same memory, or both contain null memory
references.
|
Inequality(ArchetypeChunk, ArchetypeChunk)
Two ArchetypeChunk instances are only equal if they reference the same block of chunk memory.
Declaration
public static bool operator !=(ArchetypeChunk lhs, ArchetypeChunk rhs)
Parameters
Returns
Type |
Description |
Boolean |
True, if the ArchetypeChunk instances reference different blocks of memory.
|