Пример #1
0
        public NativeArray <T> ToArray(Allocator allocator)
        {
            NativeArray <T> result = new NativeArray <T>(Length, allocator, NativeArrayOptions.UninitializedMemory);

            result.CopyFrom(this);
            return(result);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        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);
        }