文档

Unity Engine

Unity Engine

NativeArray

Creates a new NativeArray and allocates enough memory to fit the provided amount of elements.
阅读时间1 分钟最后更新于 1 个月前

Definition

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

length

Number of elements to allocate.

allocator

The Allocator to use for the data.

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

array

An array to copy the data from.

allocator

The Allocator to use for the data.

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.

allocator

The Allocator to use for the data.