Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AllocateNativeArray<T>(int)

Allocate a NativeArray of type T from memory that is guaranteed to remain valid until the end of the next Update of this World. There is no need to Dispose the NativeArray so allocated. It is not possible to free the memory by Disposing it - it is automatically freed after the end of the next Update for this World.
Read time 1 minuteLast updated 7 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule
public NativeArray<T> AllocateNativeArray<T>(int length) where T : unmanaged

Parameters

length

The length of the NativeArray to allocate, measured in elements.

Returns

Type

Description

NativeArray<T>The NativeArray allocated by this function.