com.unity.test-framework
to version 1.1.31
.com.unity.burst
to version 1.6.4
.NativeList.AsDeferredJobArray
allocator label is changed to Allocator.Invalid
to infer that the array is in list mode.NativeText.ReadOnly
type which provides a readonly, lightweight copy of a NativeText
or UnsafeText
type.Native/UnsafeMultiHashMap.GetUniqueKeyArrayNBC
extension methods from Unity.Collections.NotBurstCompatible
are not necessary anymore. Burst supports tuple. Original methods Native/UnsafeMultiHashMap.GetUniqueKeyArray
are now available again.REMOVE_DISPOSE_SENTINEL
ifdefs in all containers for future removal of DisposeSentinel.Fixed/Native/UnsafeList
.SetCapacity
and TrimExcess
to NativeList
.AllocatorHelper
to facilitate custom allocator creation and destruction.Native/UnsafeList.ParallelWriter
.AtomicSafetyHandle
issue preventing use of foreach
iterator in jobs for NativeHashSet
, NativeHashMap
, and NativeMultiHashMap
containers.Native*
containers.FixedList*
overflow checks when UNITY_DOTS_DEBUG
is enabled.Native/UnsafeList*.RemoveRange*
with index/count arguments.UnsafeText
added.[BurstCompatible]
on private methods as an error (as opposed to silently ignoring) to avoid giving the impression that private methods are being tested.NativeList<T>
generic constraint T
is changed from struct
to unmanaged
to match UnsafeList<T>
. User code can be simply fixed by changing struct
to unmanaged
when using NativeList<T>
inside generic container.NativeHashMap.GetBucketData
renamed to NativeHashMap.GetUnsafeBucketData
HeapString
renamed to NativeText
. NativeText
is based on UnsafeText
.FixedList[Byte/Int/Float][32/64/128/256/512]
are deprecated, and replaced with generics FixedList[32/64/128/256/512]<T>
.UnsafeMultiHashMap<TKey, TValue>.GetUniqueKeyArray
replaced with extension method UnsafeMultiHashMap<TKey, TValue>.GetUniqueKeyValueNBC
from Unity.Collections.NotBurstCompatible
namespace.NativeMultiHashMap<TKey, TValue>.GetUniqueKeyArray
replaced with extension method NativeMultiHashMap<TKey, TValue>.GetUniqueKeyValueNBC
from Unity.Collections.NotBurstCompatible
namespace.NativeList<T>.ToArray
replaced with extension method NativeList<T>.ToArrayNBC
from Unity.Collections.NotBurstCompatible
NativeList<T>.CopyFrom
replaced with extension method NativeList<T>.CopyFromNBC
from Unity.Collections.NotBurstCompatible
namespace.UnsafeAppendBuffer.Add
replaced with extension methodUnsafeAppendBuffer.AddNBC
from Unity.Collections.LowLevel.Unsafe.NotBurstCompatible
namespace.UnsafeAppendBuffer.ToBytes
replaced with extension method UnsafeAppendBuffer.ToBytesNBC
from Unity.Collections.LowLevel.Unsafe.NotBurstCompatible
namespace.UnsafeAppendBuffer.Reader.ReadNext
replaced with extension method UnsafeAppendBuffer.Reader.ReadNextNBC
from Unity.Collections.LowLevel.Unsafe.NotBurstCompatible
namespace.Native/UnsafeList*.RemoveRange*WithBeginEnd
methods with begin/end arguments in favor of Native/UnsafeList*.RemoveRange*
with index/count arguments.UnsafeList
and replaced it with UnsafeList<T>
.NativeQueue.PersistentMemoryBlockCount
and NativeQueue.MemoryBlockSize
are now internal APIs.[NotBurstCompatible]
attribute to FixedStringN constructors that use a String argument.[NotBurstCompatible]
attribute to NativeQueue constructor.UnsafeList<T>.Create
and UnsafeList<T>.Destroy
API.UnsafePtrList<T>
to replace deprecated untyped UnsafePtrList
.FixedList*.RemoveRange*
with index/count arguments.UnsafePtrList<T>
as replacement.FixedList*.RemoveRange*WithBeginEnd
methods with begin/end arguments in favor of FixedList*.RemoveRange*
with index/count arguments.FixedString*.Format
extension methods, use Clear()
followed by Append()
.com.unity.test-framework.performance
preview package dependency, and moved performance unit tests depending on it into different location.*BitArray.Clear
when clearing with very short bit arrays.NativeQueue.AsParallelWriter
doesn’t need to be cached when chaining jobs. Removed unnecessary safety handle that was preventing calling NativeQueue.AsParallelWriter()
multiple times when scheduling jobs.FixedListN.IndexOf
and SortJob
variantsIJob
were marked as [NotBurstCompatible]
to reflect their true Burst compatibility.com.unity.burst
to 1.4.4
NativeReference
constructor to initialize it with existing value.T[] *HashSet.ToArray()
returns an array of all elements in the set.[BurstCompatible]
attribute to FixedList and extensions.[BurstCompatible]
attribute to CollectionHelper.[BurstCompatible]
attribute to FixedBytesN.[BurstCompatible]
attribute to HeapString.[BurstCompatible]
attribute to NativeArrayExtensions.[BurstCompatible]
attribute to NativeBitArray.[BurstCompatible]
attribute to NativeBitArrayUnsafeUtility.[BurstCompatible]
attribute to NativeHashMap.[BurstCompatible]
attribute to NativeHashMapExtensions.[BurstCompatible]
attribute to NativeHashSet.[BurstCompatible]
attribute to NativeList.[BurstCompatible]
attribute to NativeListUnsafeUtility.[BurstCompatible]
attribute to NativeMultiHashMap.[BurstCompatible]
attribute to NativeQueue.[BurstCompatible]
attribute to NativeReference.[BurstCompatible]
attribute to NativeStream.[BurstCompatible]
attribute to NativeString.[BurstCompatible]
attribute to UTF8ArrayUnsafeUtility.[BurstCompatible]
attribute to Unicode and Rune.[BurstCompatible]
attribute to NativeStringView.[BurstCompatible]
attribute to UnsafeAppendBuffer.[BurstCompatible]
attribute to UnsafeAtomicCounter32 and UnsafeAtomicCounter64.[BurstCompatible]
attribute to UnsafeHashMap.[BurstCompatible]
attribute to UnsafeHashSet.[BurstCompatible]
attribute to UnsafeList, UnsafeListExtensions, UnsafePtrList, UnsafePtrListExtensions.[BurstCompatible]
attribute to UnsafeRingQueue.[BurstCompatible]
attribute to UnsafeScratchAllocator.[BurstCompatible]
attribute to UnsafeUtilityExtensions.[BurstCompatible]
attribute to VMRange, Baselib_ErrorState, and VirtualMemoryUtility.[BurstCompatible]
attribute to xxHash3.Length
would previously report backing capacity which is always 64-bit aligned, changed it to report number of bits user requested on allocation. For example, allocating 3 bits will now report Length
3 instead capacity which is always aligned to 64-bits.*HashSet.ExceptWith/IntersectWith/UnionWith
extension methods, so that use of Unity.Collections.LowLevel.Unsafe
namespace is not necessary.*UnsafeBitArray.Find
with pos/count search range arguments.UnsafeStream
block allocation performance has been improved by ~16% by appending to the start of the per-thread block lists rather than the end.FixedList*.InsertRange
, FixedList*.RemoveRangeSwapBack
, FixedList*.RemoveRange
, NativeString*
, NativeList.RemoveRangeSwapBack
, NativeList.RemoveRange
, UnsafeList.RemoveRangeSwapBack
, UnsafeList.RemoveRange
, FixedString*.Format
, FixedString*.AppendFrom
, NativeHashSet.TryAdd
, UnsafeHashSet.TryAdd
.[NativeContainerSupportsDeallocateOnJobCompletion]
attribute from NativeReference
container. It didn’t work properly. Users can use Dispose(JobHandle)
method instead.FixedList<T>
Remove
and RemoveSwapBack
extension methods were modifying copy, fixed by passing this
by reference to modify actual container.*BitArray.Find
linear search for 0-bit range.SortJob
extension methods for NativeList
, UnsafeList
, UnsafeList<T>
, and NativeSlice
.Sort
method that accepts custom comparator, and job dependency, to all supported containers.BinarySearch
extension methods for NativeArray
, NativeList
, UnsafeList
, UnsafeList<T>
, and NativeSlice
.foreach
support to UnsafeList<T>
.Sort
functions that take an IComparer
no longer require the sorted elements to be IComparable
SortJob
with default job dependency argument. Use Sort
that require an explicit JobHandle argument. If no dependency is needed, pass a default valued JobHandle.UnsafeUtilityEx
, Unity.Collections.Experimental*
,FixedString*.UTF8LengthInBytes
, and *Stream.ComputeItemCount()
*HashMap.Count()
introduced in Collections 0.10.0.Sort
method with custom comparer to FixedList*
and UnsafeList<T>
.IsEmpty
property and Clear
method to INativeList
intefrace.INativeDisposable
interface which provides a mechanism for scheduling
release of unmanaged resources.InsertRangeWithBeginEnd
to NativeList
, UnsafeList
, UnsafeList<T>
,
and UnsafePtrList
.AddRange
and AddRangeNoResize
to FixedList*
.BaselibErrorState
to check if an operation resulted in success, out of memory, or accessing an invalid address range.HeapString
type, for arbitrary-length (up to 2GB) heap-allocated strings
compatible with the FixedString*
methods. Allocating a HeapString
requires
specifying an allocator and disposing appropriately.FixedList*
method IndexOf
with index
and index/count
arguments.IJobNativeMultiHashMapMergedSharedKeyIndices
JobNativeMultiHashMapUniqueHashExtensions
IJobNativeMultiHashMapVisitKeyValue
JobNativeMultiHashMapVisitKeyValue
IJobNativeMultiHashMapVisitKeyMutableValue
JobNativeMultiHashMapVisitKeyMutableValue
IJobUnsafeMultiHashMapMergedSharedKeyIndices
JobUnsafeMultiHashMapUniqueHashExtensions
IJobUnsafeMultiHashMapVisitKeyValue
JobUnsafeMultiHashMapVisitKeyValue
IJobUnsafeMultiHashMapVisitKeyMutableValue
JobUnsafeMultiHashMapVisitKeyMutableValue
*HashMap.IsEmpty
when items are added and removed from *HashMap. IsEmpty
previously
used allocated count only to report emptiness, but returning not-empty didn’t actually
meant that *HashMap
is not empty.*HashSet.Enumerator.Current
would always return the default value instead of the actual value from the set.*HashMap/Set.Enumerator
returning wrong index and dereferencing out of bounds memory.VirtualMemoryUtility
providing low-level virtual memory utility functions backed by baselib.*HashMap
and *HashSet
now implement IEnumerable<>
.ReadArrayElementBoundsChecked
and WriteArrayElementBoundsChecked
for ease of debugging ReadArrayElement
and WriteArrayElement
without sacrificing performance by adding bounds checking directly to those functions.InsertRangeWithBeginEnd
, RemoveRangeSwapBackWithBeginEnd
, and RemoveRangeWithBeginEnd
to list containers.
*WithBeginEnd
in name signifies that arguments are begin/end instead of more standard index/count. Once
InsertRange
, RemoveRangeSwapBack
, and RemoveRange
are completely deprecated and removed,
those methods will be added with correct index/count arguments.Added xxHash3
type to expose 64/128bits hashing API using xxHash3 algorithm (corresponding to the C++ version https://github.com/Cyan4973/xxHash/releases/tag/v0.8.0)
Updated minimum Unity Editor version to 2020.1.0b15 (40d9420e7d)
Bumped burst to 1.3.2 version.
Changed *HashSet.Add
API to return bool when adding element to set.
UnsafeUtilityExtensions
is now public.
NativeReference
methods Equals
and GetHashCode
will now operate on the value instead of the data pointer.
FixedString{32,64,128,512,4096}
have been reworked.
StringBuilder
semantics.Append
methods now consistently append.Append
variant to append a char was added (appends the char
, does not resolve to int overload).Format
methods that replaced the contents of the target have been deprecated. Use Clear()
followed by Append()
. Because FixedStrings start out cleared, in most cases just an Append
is sufficient.Format
that takes a format string has been renamed to AppendFormat
. The static FixedString.Format
methods still exist for convenience, and return a FixedString128
.Append
family of methods to support appending their own types. See FixedStringAppendMethods.cs
for examples of how to declare your own extension methods.*HashSet.TryAdd
. *HashSet.Add
is equivalent.NativeString*
. The functionality is replaced by FixedString*
.InsertRange
, RemoveRangeSwap
, and RemoveRange
from list containers, and added
InsertRangeWithBeginEnd
, RemoveRangeSwapBackWithBeginEnd
, and RemoveRangeWithBeginEnd
.
*WithBeginEnd
in name signifies that arguments are begin/end instead of more standard index/count. Once
InsertRange
, RemoveRangeSwapBack
, and RemoveRange
are completely deprecated and removed,
those methods will be added with correct index/count arguments.System.Runtime.CompilerServices.Unsafe.dll
from package.All containers allocated with Allocator.Temp
on the same thread use a shared AtomicSafetyHandle
instance. This is problematic when using NativeHashMap
, NativeMultiHashMap
, NativeHashSet
and NativeList
together in situations where their secondary safety handle is used. This means that operations that invalidate an enumerator for either of these collections (or the NativeArray
returned by NativeList.AsArray
) will also invalidate all other previously acquired enumerators.
For example, this will throw when safety checks are enabled:
var list = new NativeList<int>(Allocator.Temp);
list.Add(1);
// This array uses the secondary safety handle of the list, which is
// shared between all Allocator.Temp allocations.
var array = list.AsArray();
var list2 = new NativeHashSet<int>(Allocator.Temp);
// This invalidates the secondary safety handle, which is also used
// by the list above.
list2.TryAdd(1);
// This throws an InvalidOperationException because the shared safety
// handle was invalidated.
var x = array[0];
This defect will be addressed in a future release.
Native/UnsafeHashSet
containers.IsEmpty
method to *Queue
, *HashMap
, *MultiHashMap
, *List
, FixedString
.
This method should be prefered to Count() > 0
due to simpler checks for empty container.NativeReference
to hold unmanaged allocation.CollectionsTestFixture
to enable jobs debugger and verify safety checks are enabled.NativeList.CopyFrom(NativeArray<> array)
com.unity.burst
to version 1.3.0-preview.12
.CollectionsTestFixture
to prevent crashing when running tests without jobs debugger or safety checks enabled.NativeBitArray.AsNativeArray<T>
method to reinterpret NativeBitArray
as
NativeArray
of desired type.NativeArrayChunked8
and NativeArrayFullSOA
from Unity.Collections.Experimental.UnsafeUtilityEx.As/AsRef/ArrayElementAsRef
. The functionality is available in UnsafeUtility
.FixedString
and FixedList
types now display their contents in the Entity Inspector.NativeHashMap.ParallelWriter.TryAdd
race condition.RemoveAt
and RemoveRange
to List containers in collections. These methods remove
elements in list container while preserving order of the list. These methods are slower than
Remove*SwapBack
methods and users should prefer Remove*SwapBack
if they don’t care about
preserving order inside *List container.*BitArray.Copy
between two different bit arrays.NativeBitArrayUnsafeUtility.ConvertExistingDataToNativeBitArray
for assigning view into
data as bit array.com.unity.burst
to version 1.3.0-preview.11
NativeMultiHashMap.Remove<TValueEQ>(TKey key, TValueEq value)
into an extension method and made it Burst compatible*HashMap.Remove
to not throw when removing from empty hash map.Native/UnsafeBitArray.Copy
for copying or shifting bits inside array.UnsafeAtomicCounter32/64
providing helper interface for atomic counter functionality.NativeBitArray
providing arbitrary sized bit array functionality with safety mechanism.IJobNativeMultiHashMapMergedSharedKeyIndices
, JobNativeMultiHashMapUniqueHashExtensions
,
IJobNativeMultiHashMapVisitKeyValue
, JobNativeMultiHashMapVisitKeyValue
, IJobNativeMultiHashMapVisitKeyMutableValue
,
JobNativeMultiHashMapVisitKeyMutableValue
, and introduced NativeHashMap.GetUnsafeBucketData
and
NativeMultiHashMap.GetUnsafeBucketData
to obtain internals to implement deprecated functionality
inside user code. If this functionality is used, the best is to copy deprecated code into user code.class TerminatesProgramAttribute
Length
property from NativeHashMap
, UnsafeHashMap
, NativeMultiHashMap
,
UnsafeMultiHashMap
, NativeQueue
, and replaced it with Count()
to reflect that there
is computation being done.FixedListDebugView<T>
only existed for IComparable types, which lead to a crash while debugging other types.NativeQueue<T>.ToArray
to copy a native queue to an array efficientlyLength
property from NativeHashMap
, UnsafeHashMap
, NativeMultiHashMap
,
UnsafeMultiHashMap
, NativeQueue
, and replaced it with Count()
to reflect that there
is computation being done.CollectionHelper.CeilPow2()
CollectionHelper.lzcnt()
struct ResizableArray64Byte<T>
NativeStream
incompatible with Burst.UnsafeAppendBuffer
from a DisposeJob
.UnsafeAppendBuffer
field Size
renamed to Length
.[BurstDiscard]
from all validation check functions. Validation is present in code compiled with Burst.NativeStream.ScheduleConstruct
without explicit allocators.UnsafeBitArray
out-of-bounds access.NativeList<T>
parallel reader/writer to match functionality of UnsafeList
parallel reader/writer.UnsafeUtilityEx.RestrictNoAlias
NativeList.CopyFrom
.UnsafeRingQueue<T>
providing fixed-size circular buffer functionality.IDisposable
constraint to UnsafeList
and UnsafeBitArray
.ReadNextArray<T>
to access a raw array (pointer and length) from an UnsafeAppendBuffer.Reader
.FixedList<T>
generic self-contained List structBitArray.SetBits
with arbitrary ulong value.BitArray.GetBits
to retrieve bits as ulong value.UnsafeBitArray
memory initialization option default to NativeArrayOptions.ClearMemory
.FixedList
structs to pad to natural alignment of item held in listBlobAssetComputationContext.AssociateBlobAssetWithGameObject(int, GameObject)
replaced by its UnityEngine.Object
counterpart BlobAssetComputationContext.AssociateBlobAssetWithUnityObject(int, UnityEngine.Object)
to allow association of BlobAsset with any kind of UnityEngine.Object
derived types.IEquatable
constraint from UnsafeList<T>
.BitArray.SetBits
.This version requires Unity 2019.3.0f1+
FixedListTN
as a non-generic replacement for ResizableArrayN<T>
.UnsafeBitArray
providing arbitrary sized bit array functionality.[NativeDisableUnsafePtrRestriction]
to UnsafeList
to allow burst compilation.BitField32
and BitField64
bit array.Removed the following deprecated API as announced in/before 0.1.1-preview
:
struct Concurrent
and ToConcurrent()
for NativeHashMap
, NativeMultiHashMap
and NativeQueue
(replaced by the ParallelWriter API).struct NativeStreamReader
and struct NativeStreamWriter
, replaced by struct NativeStream.Reader
and struct NativeStream.Writer
.ToDeferredJobArray()
(replaced by AsDeferredJobArray()
API).This version requires Unity 2019.3 0b11+
Native(Multi)HashMap.GetKeyValueArrays
that will query keys and values
at the same time into parallel arrays.UnsafeStream
, UnsafeHashMap
, and UnsafeMultiHashMap
, providing
functionality of NativeStream
container but without any safety mechanism
(intended for advanced users only).AddNoResize
methods to NativeList
. When it’s known ahead of time that
list won’t grow, these methods won’t try to resize. Rather exception will be
thrown if capacity is insufficient.ParallelWriter
support for UnsafeList
.UnsafeList.TrimExcess
to set capacity to actual number of elements in
the container.UnsafeList<T>
managed container with unmanaged T
constraint.UnsafeList.Resize
now doesn’t resize to lower capacity. User must call
UnsafeList.SetCapacity
to lower capacity of the list. This applies to all other
containers based on UnsafeList
.NativeHashMap.Remove(TKey key, TValueEQ value)
is now supported in bursted code.NativeList.ToDeferredJobArray()
back in - Use AsDeferredJobArray()
instead. The deprecated function will be removed in 3 months. This can not be auto-upgraded
prior to Unity 2019.3
.TryDequeue
on an empty NativeQueue
that previously had enqueued elements could leave it in
an invalid state where Enqueue
would fail silently afterwards.Native*.Concurrent
is renamed to Native*.ParallelWriter
.Native*.ToConcurrent()
function is renamed to Native*.AsParallelWriter()
.NativeStreamReader/Writer
structs are subclassed and renamed to
NativeStream.Reader/Writer
(note: changelot entry added retroactively).Unity.Collections.Tests
NativeList
CollectionHelper.WriteLayout
debug utilityNativeQueue
alignment issue.Change tracking started with this version.