Method AllocateNativeArray
AllocateNativeArray<T>(int)
Allocate a NativeArray of type T from memory that's guaranteed to remain valid until Rewind() is called on the Scratchpad.
Declaration
[GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[] { typeof(int) })]
public NativeArray<T> AllocateNativeArray<T>(int length) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | length | The number of items in the NativeArray. |
Returns
Type | Description |
---|---|
NativeArray<T> | Returns the NativeArray. |
Type Parameters
Name | Description |
---|---|
T | The NativeArray. |
Remarks
This memory isn't shared between threads and you don't need to Dispose the NativeArray so it's allocated. You can't Dispose the memory to free it: it's automatically freed when Rewind() is called.