Version: 2023.2
LanguageEnglish
  • C#

NativeSetClassTypeToNullOnScheduleAttribute

class in Unity.Collections.LowLevel.Unsafe

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

When this attribute is applied to a field in a job struct, the managed reference to the class will be set to null on the copy of the job struct that is passed to the job.

The C# job system does not allow managed references in the job struct. Sometimes it is necessary to have a class in a job struct, even though in the context of the job it is always null. Additional resources: IJob.