An interface for creating structs that can be stored in a DynamicBuffer<T>.
public interface IBufferElementData
IBufferElementData implementations are subject to the same constraints as IComponentData.
Create a DynamicBuffer<T> containing a given type
T by adding that IBufferElementData type to
an entity. The DynamicBuffer container is created automatically. You can specify the maximum number of elements a buffer
stores inside a chunk by placing an InternalBufferCapacityAttribute on the IBufferElementData
declaration. When the number of elements exceeds the internal capacity, the entire is moved outside the chunk
into heap memory. (In either case, you access an element the same way through the dynamic buffer API.)
To remove a buffer from an entity, remove that entity's IBufferElementData component. (To remove an individual element from a buffer, call RemoveAt(Int32).)
You can find entities with a particular type of buffer using either EntityQuery or EntityQueryBuilder in the same way you select entities with specific types of IComponentData. Use the IBufferElementData type in the query (not DynamicBuffer).
To access the buffer of an entity in a JobComponentSystem, define a field of type,
The DynamicBuffer interface provides array-like access to buffer contents. You can treat a buffer like a NativeArray. You can also use Reinterpret<U>() to treat the buffer as a container of the underlying type, rather than a container of IBufferElementData.
See Dynamic Buffers for additional information.