Example #1
0
        public NativeArray(NativeArray <T> array, Allocator allocator)
        {
            AtomicSafetyHandle.CheckReadAndThrow(array.m_Safety);
            NativeArray <T> .Allocate(array.Length, allocator, out this);

            NativeArray <T> .Copy(array, 0, this, 0, array.Length);
        }
Example #2
0
        public NativeArray(int length, Allocator allocator, NativeArrayOptions options = NativeArrayOptions.ClearMemory)
        {
            NativeArray <T> .Allocate(length, allocator, out this);

            if ((options & NativeArrayOptions.ClearMemory) == NativeArrayOptions.ClearMemory)
            {
                UnsafeUtility.MemClear(this.m_Buffer, (ulong)((long)this.Length * (long)UnsafeUtility.SizeOf <T>()));
            }
        }
Example #3
0
        public NativeArray(T[] array, Allocator allocator)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            NativeArray <T> .Allocate(array.Length, allocator, out this);

            this.CopyFrom(array);
        }
Example #4
0
        public NativeArray(T[] array, Allocator allocator)
        {
            bool flag = array == null;

            if (flag)
            {
                throw new ArgumentNullException("array");
            }
            NativeArray <T> .Allocate(array.Length, allocator, out this);

            NativeArray <T> .Copy(array, this);
        }
Example #5
0
        public NativeArray(NativeArray <T> array, Allocator allocator)
        {
            NativeArray <T> .Allocate(array.Length, allocator, out this);

            this.CopyFrom(array);
        }