public static void CopyWithIndex <T, TCopy>(NativeBufferArray <T> fromArr, ref NativeBufferArray <T> arr, TCopy copy) where TCopy : IArrayElementCopyWithIndex <T> where T : struct { if (fromArr.isCreated == false) { if (arr.isCreated == true) { NativeArrayUtils.RecycleWithIndex(ref arr, copy); } arr = NativeBufferArray <T> .Empty; return; } if (arr.isCreated == false || fromArr.Length != arr.Length) { if (arr.isCreated == true) { NativeArrayUtils.RecycleWithIndex(ref arr, copy); } arr = PoolArrayNative <T> .Spawn(fromArr.Length); } for (int i = 0; i < fromArr.Length; ++i) { copy.Copy(i, fromArr.arr[i], ref arr.arr.GetRef(i)); } }
public void Recycle() { PoolArrayNative <Archetype> .Recycle(ref this.prevTypes); PoolArrayNative <Archetype> .Recycle(ref this.types); }