public NativeListImpl <T, TMemManager> Clone() { var clone = new NativeListImpl <T, TMemManager>(Capacity, m_MemoryAllocator.Label); UnsafeUtility.MemCpy(clone.m_ListData->buffer, m_ListData->buffer, m_ListData->length * UnsafeUtility.SizeOf <T>()); clone.m_ListData->length = m_ListData->length; return(clone); }
unsafe NativeList(int capacity, Allocator i_label, int stackDepth) { #if ENABLE_UNITY_COLLECTIONS_CHECKS var guardian = new NativeBufferSentinel(stackDepth, i_label); m_Safety = (i_label == Allocator.Temp) ? AtomicSafetyHandle.GetTempMemoryHandle() : AtomicSafetyHandle.Create(); m_Impl = new NativeListImpl <T, DefaultMemoryManager, NativeBufferSentinel>(capacity, i_label, guardian); #else m_Impl = new NativeListImpl <T, DefaultMemoryManager>(capacity, i_label); #endif }