文档

Unity Engine

Unity Engine

AllocateNativeList<T>(int)

Allocate a NativeList of type T from memory that's guaranteed to remain valid until ScratchpadAllocator.Rewind is called on the Scratchpad.
阅读时间1 分钟最后更新于 19 天前

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public NativeList<T> AllocateNativeList<T>(int capacity) where T : unmanaged

Parameters

capacity

The number of items the list can hold.

Returns

Type

Description

NativeList<T>Returns the NativeList

Remarks

This memory isn't shared between threads and you don't need to Dispose the NativeList so it's allocated. You can't Dispose the memory to free it: it's automatically freed when ScratchpadAllocator.Rewind is called.