using System; using System.Collections; using System.Collections.Generic; using System.Security.Cryptography; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using UnityEngine; namespace SLZ.CustomStaticBatching { public static unsafe class NativeArraySubArray { public static unsafe NativeArray GetSubArrayAlias(NativeArray array, int start, int length) where T : unmanaged where T2 : unmanaged { void* dataPointer = ((byte*)array.GetUnsafePtr()) + start * sizeof(T); NativeArray outp = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray(dataPointer, length, Allocator.None); #if ENABLE_UNITY_COLLECTIONS_CHECKS NativeArrayUnsafeUtility.SetAtomicSafetyHandle(ref outp, AtomicSafetyHandle.GetTempMemoryHandle()); #endif return outp; } } }