Method CopyFrom
CopyFrom(NativeArray<T>)
Copies all the elements from the specified native array into this dynamic buffer.
Declaration
public void CopyFrom(NativeArray<T> v)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<T> | v | The native array containing the elements to copy. |
Examples
int[] sourceArray = { 1, 2, 3, 4, 5 };
NativeArray<int> nativeArray = new NativeArray<int>(source, Allocator.Persistent);
buffer.CopyFrom(nativeArray);
CopyFrom(NativeSlice<T>)
Copies all the elements from the specified native slice into this dynamic buffer.
Declaration
public void CopyFrom(NativeSlice<T> v)
Parameters
Type | Name | Description |
---|---|---|
NativeSlice<T> | v | The native slice containing the elements to copy. |
Examples
NativeSlice<int> nativeSlice = new NativeSlice<int>(nativeArray, 1, 3);
buffer.CopyFrom(nativeSlice);
CopyFrom(DynamicBuffer<T>)
Copies all the elements from another dynamic buffer.
Declaration
public void CopyFrom(DynamicBuffer<T> v)
Parameters
Type | Name | Description |
---|---|---|
DynamicBuffer<T> | v | The dynamic buffer containing the elements to copy. |
Examples
buffer.CopyFrom(secondBuffer);
CopyFrom(T[])
Copies all the elements from an array.
Declaration
public void CopyFrom(T[] v)
Parameters
Type | Name | Description |
---|---|---|
T[] | v | A C# array containing the elements to copy. |
Examples
int[] integerArray = { 1, 2, 3, 4, 5 };
buffer.CopyFrom(integerArray);
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the given array is empty. |