Class NativeCollectionsExtensions
- Namespace
- RisingV.Shared.Extensions
- Assembly
- RisingV.Shared.dll
Provides extension methods for working with Unity's Native Collections.
public static class NativeCollectionsExtensions
- Inheritance
-
NativeCollectionsExtensions
- Inherited Members
Methods
IsEmpty<T>(NativeArray<T>)
Checks if a NativeArray is empty.
public static bool IsEmpty<T>(this NativeArray<T> nativeArray) where T : unmanaged
Parameters
nativeArrayNativeArray<T>The NativeArray to check.
Returns
- bool
True if the NativeArray is empty, otherwise false.
Type Parameters
TThe type of elements in the NativeArray, must be unmanaged.
IsNullOrEmpty<T>(NativeArray<T>?)
Checks if a NativeArray is null or empty.
public static bool IsNullOrEmpty<T>(this NativeArray<T>? nativeArray) where T : unmanaged
Parameters
nativeArrayNativeArray<T>?The NativeArray to check.
Returns
- bool
True if the NativeArray is null or empty, otherwise false.
Type Parameters
TThe type of elements in the NativeArray, must be unmanaged.
PrintItems<T>(NativeArray<T>, Logger, LogLevel)
Prints each item in a NativeArray to the specified logger at the specified log level.
public static void PrintItems<T>(this NativeArray<T> array, Logger logger, LogLevel logLevel = LogLevel.Debug) where T : unmanaged
Parameters
arrayNativeArray<T>The NativeArray whose items will be printed.
loggerLoggerThe logger to which the items will be printed.
logLevelLogLevelThe log level at which to print the items.
Type Parameters
TThe type of elements in the NativeArray, must be unmanaged.
PrintItems<TValue>(NativeList<TValue>, Logger, LogLevel)
Prints each item in a NativeList to the specified logger at the specified log level.
public static void PrintItems<TValue>(this NativeList<TValue> list, Logger logger, LogLevel logLevel = LogLevel.Debug) where TValue : unmanaged
Parameters
listNativeList<TValue>The NativeList whose items will be printed.
loggerLoggerThe logger to which the items will be printed.
logLevelLogLevelThe log level at which to print the items.
Type Parameters
TValueThe type of elements in the NativeList, must be unmanaged.
PrintItems<TKey, TValue>(NativeHashMap<TKey, TValue>, Logger, LogLevel)
Prints each key-value pair in a NativeHashMap to the specified logger at the specified log level.
public static void PrintItems<TKey, TValue>(this NativeHashMap<TKey, TValue> map, Logger logger, LogLevel logLevel = LogLevel.Debug) where TKey : unmanaged
Parameters
mapNativeHashMap<TKey, TValue>The NativeHashMap whose items will be printed.
loggerLoggerThe logger to which the items will be printed.
logLevelLogLevelThe log level at which to print the items.
Type Parameters
TKeyThe type of keys in the NativeHashMap, must be unmanaged.
TValueThe type of values in the NativeHashMap, must be unmanaged.
ToList<T>(NativeList<T>)
Converts a NativeArray to a List.
public static List<T> ToList<T>(this NativeList<T> nativeList) where T : unmanaged
Parameters
nativeListNativeList<T>The NativeArray to convert.
Returns
- List<T>
A List containing the elements from the NativeArray.
Type Parameters
TThe type of elements in the NativeArray, must be unmanaged.
ToStringBy<T>(NativeArray<T>, Func<T, string>, string)
Converts a NativeArray to a string representation using a specified function for each element.
public static string ToStringBy<T>(this NativeArray<T> array, Func<T, string> func, string separator = ", ") where T : unmanaged
Parameters
arrayNativeArray<T>The NativeArray to convert.
funcFunc<T, string>The function to apply to each element of the NativeArray to convert it to a string.
separatorstringThe separator to use between elements in the resulting string.
Returns
- string
A string representation of the NativeArray, with each element converted using the specified function and separated by the specified separator.
Type Parameters
TThe type of elements in the NativeArray, must be unmanaged.