Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

DynamicBuffer<T0>

struct in Unity.Entities


Implements interfaces:IIndexable<T0>, INativeList<T0>, IQueryTypeParameter

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An array-like data structure that can be used as a component.

Properties

Property Description
Capacity The number of elements the buffer can hold.
IsCreated Whether the memory for this dynamic buffer has been allocated.
IsEmpty Reports whether container is empty.
Length The number of elements the buffer holds.
this[int] Array-like indexing operator.

Public Methods

Method Description
Add Adds an element to the end of the buffer, resizing as necessary.
AddRange Adds all the elements from newElems to the end of the buffer, resizing as necessary.
AsNativeArray Return a native array that aliases the original buffer contents.
Clear Sets the buffer length to zero.
CopyFrom Copies all the elements from the specified native array into this dynamic buffer.
ElementAt Gets the reference to the element at the given index.
EnsureCapacity Ensures that the buffer has at least the specified capacity.
GetEnumerator Provides an enumerator for iterating over the buffer elements.
GetUnsafePtr Gets an unsafe read/write pointer to the contents of the buffer.
GetUnsafeReadOnlyPtr Gets an unsafe read-only pointer to the contents of the buffer.
Insert Inserts an element at the specified index, resizing as necessary.
Reinterpret Returns a dynamic buffer of a different type, pointing to the same buffer memory.
RemoveAt Removes the element at the specified index.
RemoveAtSwapBack Removes the element at the specified index and swaps the last element into its place. This is more efficient than moving all elements following the removed element, but does change the order of elements in the buffer.
RemoveRange Removes the specified number of elements, starting with the element at the specified index.
RemoveRangeSwapBack Removes the specified number of elements, starting with the element at the specified index. It replaces the elements that were removed with a range of elements from the back of the buffer. This is more efficient than moving all elements following the removed elements, but does change the order of elements in the buffer.
Resize Sets the length of this buffer, increasing the capacity if necessary.
ResizeUninitialized Sets the length of this buffer, increasing the capacity if necessary.
ToNativeArray Copies the buffer into a new native array.
TrimExcess Removes any excess capacity in the buffer.