Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CollectionHelper

Provides helper methods for collections.
Read time 1 minuteLast updated 13 days ago

Definition

public static class CollectionHelper

Static Fields

Value

Description

CacheLineSizeThe size in bytes of the current platform's L1 cache lines.

Static Methods

Method

Description

AlignReturns an allocation size in bytes that factors in alignment.
CheckReflectionDataCorrectChecks that reflection data was properly registered for a job.
ConvertExistingDataToNativeArrayConvert existing data into a NativeArray.
ConvertExistingNativeListToNativeArrayConvert NativeList into a NativeArray.
CreateNativeArrayCreate a NativeArray from a managed array, using a provided AllocatorHandle.
CreateNativeParallelMultiHashMapCreate a NativeParallelMultiHashMap from a managed array, using a provided Allocator.
CreateSafetyHandleCreates a new AtomicSafetyHandle that is valid until CollectionHelper.DisposeSafetyHandle is called.
DisposeDispose a NativeArray from an AllocatorHandle where it is allocated.
DisposeNativeArrayDispose a NativeArray from an AllocatorHandle where it is allocated.
DisposeSafetyHandleDisposes a previously created AtomicSafetyHandle.
HashReturns a (non-cryptographic) hash of a memory block.
IsAlignedReturns true if an offset has a given alignment.
IsPowerOfTwoReturns true if a positive value is a non-zero power of two.
Log2CeilReturns the binary logarithm of the
value
, but the result is rounded up to the nearest integer.
Log2FloorReturns the binary logarithm of the
value
, but the result is rounded down to the nearest integer.
SetStaticSafetyIdAssigns the provided static safety ID to an AtomicSafetyHandle. The ID's owner type name and any custom error messages are used by the job debugger when reporting errors involving the target handle.

Structs

Struct

Description

CollectionHelper.DummyJobEmpty job type used for Burst compilation testing