Esempio n. 1
0
        public static NativeBufferArray <T> Spawn(int length, bool realSize = false, Unity.Collections.Allocator allocator = Unity.Collections.Allocator.Persistent)
        {
            var arrSize = PoolArray <T> .GetSize(length);

            var arr    = new Unity.Collections.NativeArray <T>(arrSize, allocator);
            var size   = (realSize == true ? arr.Length : length);
            var buffer = new NativeBufferArray <T>(arr, length, realSize == true ? arr.Length : -1);

            NativeArrayUtils.Clear(buffer, 0, size);

            return(buffer);
        }