Version: 2023.2

DeallocateOnJobCompletionAttribute

class in Unity.Collections

切换到手册

描述

Automatically deallocates the native container when the job is finished.

Apply this attribute to native container fields in a job struct, provided the type of the field is marked with the NativeContainerSupportsDeallocateOnJobCompletionAttribute. In particular, fields of type NativeArray can be automatically deallocated with this mechanism. When the job finishes execution, the job system automatically deallocates the native container. Additional resources: NativeContainerSupportsDeallocateOnJobCompletionAttribute