Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

CollectionHelper.CreateNativeArray

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

Declaration

public static NativeArray<T> CreateNativeArray(int length, ref U allocator, NativeArrayOptions options);

Parameters

Parameter Description
length The number of elements to allocate.
allocator The allocator to use.
options Options for allocation, such as whether to clear the memory.

Returns

NativeArray<T> Returns the NativeArray that was created.

Description

Create a NativeArray, using a provided allocator that implements IAllocator.


Declaration

public static NativeArray<T> CreateNativeArray(int length, AllocatorHandle allocator, NativeArrayOptions options);

Parameters

Parameter Description
length The number of elements to allocate.
allocator The AllocatorHandle to use.
options Options for allocation, such as whether to clear the memory.

Returns

NativeArray<T> Returns the NativeArray that was created.

Description

Create a NativeArray, using a provided AllocatorHandle.


Declaration

public static NativeArray<T> CreateNativeArray(NativeArray<T> array, AllocatorHandle allocator);

Parameters

Parameter Description
array The NativeArray to make a copy of.
allocator The AllocatorHandle to use.

Returns

NativeArray<T> Returns the NativeArray that was created.

Description

Create a NativeArray from another NativeArray, using a provided AllocatorHandle.


Declaration

public static NativeArray<T> CreateNativeArray(T[] array, AllocatorHandle allocator);

Parameters

Parameter Description
array The managed array to make a copy of.
allocator The AllocatorHandle to use.

Returns

NativeArray<T> Returns the NativeArray that was created.

Description

Create a NativeArray from a managed array, using a provided AllocatorHandle.


Declaration

public static NativeArray<T> CreateNativeArray(T[] array, ref U allocator);

Parameters

Parameter Description
array The managed array to make a copy of.
allocator The Allocator to use.

Returns

NativeArray<T> Returns the NativeArray that was created.

Description

Create a NativeArray from a managed array, using a provided Allocator.