public static bool Resize <T>(int index, ref Unity.Collections.NativeHashSet <T> arr, Unity.Collections.Allocator allocator = Unity.Collections.Allocator.Persistent, bool resizeWithOffset = false) where T : unmanaged, System.IEquatable <T> { int offset = 1; if (resizeWithOffset == true) { offset *= 2; } var capacity = index * offset + 1; if (arr.IsCreated == false) { arr = new Unity.Collections.NativeHashSet <T>(capacity, allocator); } if (capacity > arr.Capacity) { arr.Capacity = capacity; return(true); } return(false); }
public static unsafe void Clear <T>(Unity.Collections.NativeHashSet <T> arr) where T : unmanaged, System.IEquatable <T> { arr.Clear(); }