NativeDisableUnsafePtrRestrictionAttribute
Enable the use of unsafe pointers in jobs.
Read time 3 minutesLast updated 12 days ago
Definition
- Type: Class
- Namespace: Unity.Collections.LowLevel.Unsafe
- Assembly: UnityEngine.ScriptingModule
- Inherits from: Attribute
[AttributeUsage(AttributeTargets.Field)]public sealed class NativeDisableUnsafePtrRestrictionAttribute : Attribute
Remarks
By default, unsafe pointers aren't allowed in jobs because it isn't possible for the Job Debugger to gurantee race condition free behavior. This attribute lets you explicitly disable the restriction on a job.
Examples
struct MyJob : IJob{ [NativeDisableUnsafePtrRestriction] int* myCustomPointer; void Execute() { ... }}