# NativeArray

> Creates a new NativeArray and allocates enough memory to fit the provided amount of elements.

## Definition

* **Type:** Constructor
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## NativeArray(int, Allocator, NativeArrayOptions)

Creates a new NativeArray and allocates enough memory to fit the provided amount of elements.

```csharp
public NativeArray(int length, Allocator allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to allocate.**** (\[Allocator]\(/engine/6000.7/script-reference/unity/collections/allocator)): The [Allocator](/engine/6000.7/script-reference/unity/collections/allocator.md) to use for the data.**** (\[NativeArrayOptions]\(/engine/6000.7/script-reference/unity/collections/nativearrayoptions)): The [NativeArrayOptions](/engine/6000.7/script-reference/unity/collections/nativearrayoptions.md) to use for the data.

## NativeArray(int, MemoryLabel, NativeArrayOptions)

Creates a new NativeArray and allocates enough memory to fit the provided number of elements, using the specified memory label.

```csharp
public NativeArray(int length, MemoryLabel label, NativeArrayOptions options = NativeArrayOptions.ClearMemory)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of elements to allocate.**** (\[MemoryLabel]\(/engine/6000.7/script-reference/unity/collections/memorylabel)): The [MemoryLabel](/engine/6000.7/script-reference/unity/collections/memorylabel.md) to allocate under.**** (\[NativeArrayOptions]\(/engine/6000.7/script-reference/unity/collections/nativearrayoptions)): The [NativeArrayOptions](/engine/6000.7/script-reference/unity/collections/nativearrayoptions.md) to use for the data.

## NativeArray(\`0\[], Allocator)

Creates a NativeArray from an array of elements.

```csharp
public NativeArray(T[] array, Allocator allocator)
```

### Parameters

**** (\[\<T>\[]]\(./)): An array to copy the data from.**** (\[Allocator]\(/engine/6000.7/script-reference/unity/collections/allocator)): The [Allocator](/engine/6000.7/script-reference/unity/collections/allocator.md) to use for the data.

## NativeArray(\`0\[], MemoryLabel)

Creates a NativeArray from an array of elements, using the specified memory label.

```csharp
public NativeArray(T[] array, MemoryLabel label)
```

### Parameters

**** (\[\<T>\[]]\(./)): An array to copy the data from.**** (\[MemoryLabel]\(/engine/6000.7/script-reference/unity/collections/memorylabel)): The [MemoryLabel](/engine/6000.7/script-reference/unity/collections/memorylabel.md) to allocate under.

## NativeArray(NativeArray\<T>, Allocator)

Creates a NativeArray from an existing NativeArray.

```csharp
public NativeArray(NativeArray<T> array, Allocator allocator)
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.7/script-reference/unity/collections/nativearray1)): The [NativeArray\<T>](/engine/6000.7/script-reference/unity/collections/nativearray1.md) to copy the data from.**** (\[Allocator]\(/engine/6000.7/script-reference/unity/collections/allocator)): The [Allocator](/engine/6000.7/script-reference/unity/collections/allocator.md) to use for the data.

## NativeArray(NativeArray\<T>, MemoryLabel)

Creates a NativeArray from an existing NativeArray, using the specified memory label.

```csharp
public NativeArray(NativeArray<T> array, MemoryLabel label)
```

### Parameters

**** (\[NativeArray\<T>]\(/engine/6000.7/script-reference/unity/collections/nativearray1)): The [NativeArray\<T>](/engine/6000.7/script-reference/unity/collections/nativearray1.md) to copy the data from.**** (\[MemoryLabel]\(/engine/6000.7/script-reference/unity/collections/memorylabel)): The [MemoryLabel](/engine/6000.7/script-reference/unity/collections/memorylabel.md) to allocate under.
