NativeArray
Creates a new NativeArray and allocates enough memory to fit the provided amount of elements.
Read time 2 minutesLast updated 5 days ago
Definition
- Type: Constructor
- Namespace: Unity.Collections
- Assembly: UnityEngine.CoreModule
NativeArray(int, Allocator, NativeArrayOptions)
Creates a new NativeArray and allocates enough memory to fit the provided amount of elements.
public NativeArray(int length, Allocator allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory)
Parameters
NativeArray(int, MemoryLabel, NativeArrayOptions)
Creates a new NativeArray and allocates enough memory to fit the provided number of elements, using the specified memory label.
public NativeArray(int length, MemoryLabel label, NativeArrayOptions options = NativeArrayOptions.ClearMemory)
Parameters
Number of elements to allocate.
The MemoryLabel to allocate under.
The NativeArrayOptions to use for the data.
NativeArray(`0[], Allocator)
Creates a NativeArray from an array of elements.
public NativeArray(T[] array, Allocator allocator)
Parameters
NativeArray(`0[], MemoryLabel)
Creates a NativeArray from an array of elements, using the specified memory label.
public NativeArray(T[] array, MemoryLabel label)
Parameters
NativeArray(NativeArray<T>, Allocator)
Creates a NativeArray from an existing NativeArray.
public NativeArray(NativeArray<T> array, Allocator allocator)
Parameters
The NativeArray<T> to copy the data from.
NativeArray(NativeArray<T>, MemoryLabel)
Creates a NativeArray from an existing NativeArray, using the specified memory label.
public NativeArray(NativeArray<T> array, MemoryLabel label)