public NativeArray <T> ToArray(Allocator allocator) { NativeArray <T> result = new NativeArray <T>(Length, allocator, NativeArrayOptions.UninitializedMemory); result.CopyFrom(this); return(result); }
/// <summary> /// Overwrites this list with the elements of an array. /// </summary> /// <param name="array">A managed array or /// [NativeArray](https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.html) to copy /// into this list.</param> public void CopyFrom(T[] array) { Resize(array.Length, NativeArrayOptions.UninitializedMemory); NativeArray <T> na = AsArray(); na.CopyFrom(array); }
public void CopyFrom(T[] array) { //@TODO: Thats not right... This doesn't perform a resize Capacity = array.Length; NativeArray <T> nativeArray = this; nativeArray.CopyFrom(array); }