#pragma warning restore 649 public unsafe void InitializeFrom <TSafetyHandleContainer>(TSafetyHandleContainer *handles, int where) where TSafetyHandleContainer : unmanaged, ISafetyHandleContainable { Buffer0.InitializeFrom(handles, where + 0 * 5); Buffer1.InitializeFrom(handles, where + 1 * 5); Buffer2.InitializeFrom(handles, where + 2 * 5); Buffer3.InitializeFrom(handles, where + 3 * 5); Buffer4.InitializeFrom(handles, where + 4 * 5); }
#pragma warning restore 649 public unsafe void InitializeFrom <TSafetyHandleContainer>(TSafetyHandleContainer *handles, int where) where TSafetyHandleContainer : unmanaged, ISafetyHandleContainable { // Just to avoid Unity checks against null-pointer native arrays. // We're never going to dereference it. // Also add offset to avoid alias analysis issues. var invalidMemory = (void *)(0xDEAD0000 + where * 0x10); Buffer0 = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray <int>(invalidMemory, 0, Allocator.Invalid); NativeArrayUnsafeUtility.SetAtomicSafetyHandle(ref Buffer0, handles[where].SafetyHandle); }