public NativeSlice <EcsLane> GetLeftLanes(DynamicBuffer <EcsLane> lanes) { return(new NativeSlice <EcsLane>(lanes.AsNativeArray(), firstLaneIndex, LeftLaneCount)); }
public NativeSlice <LaneWidthRecord> GetLaneWidthRecords(DynamicBuffer <LaneWidthRecord> laneWidthRecords) { return(new NativeSlice <LaneWidthRecord>(laneWidthRecords.AsNativeArray(), firstLaneWidthRecordIndex, laneWidthRecordCount)); }
private void ShowAdd() { DynamicBuffer <int> buffer = new DynamicBuffer <int>(); DynamicBuffer <int> secondBuffer = new DynamicBuffer <int>(); #region dynamicbuffer.add buffer.Add(5); #endregion #region dynamicbuffer.addrange int[] source = { 1, 2, 3, 4, 5 }; NativeArray <int> newElements = new NativeArray <int>(source, Allocator.Persistent); buffer.AddRange(newElements); #endregion #region dynamicbuffer.asnativearray int[] intArray = { 1, 2, 3, 4, 5 }; NativeArray <int> .Copy(intArray, buffer.AsNativeArray()); #endregion #region dynamicbuffer.capacity #endregion #region dynamicbuffer.clear buffer.Clear(); #endregion #region dynamicbuffer.copyfrom.dynamicbuffer buffer.CopyFrom(secondBuffer); #endregion #region dynamicbuffer.copyfrom.nativearray int[] sourceArray = { 1, 2, 3, 4, 5 }; NativeArray <int> nativeArray = new NativeArray <int>(source, Allocator.Persistent); buffer.CopyFrom(nativeArray); #endregion #region dynamicbuffer.copyfrom.array int[] integerArray = { 1, 2, 3, 4, 5 }; buffer.CopyFrom(integerArray); #endregion #region dynamicbuffer.getenumerator foreach (var element in buffer) { //Use element... } #endregion #region dynamicbuffer.getunsafeptr #endregion int insertionIndex = 2; #region dynamicbuffer.insert if (insertionIndex < buffer.Length) { buffer.Insert(insertionIndex, 6); } #endregion #region dynamicbuffer.iscreated #endregion #region dynamicbuffer.length for (int i = 0; i < buffer.Length; i++) { buffer[i] = i * i; } #endregion #region dynamicbuffer.removeat if (insertionIndex < buffer.Length) { buffer.RemoveAt(insertionIndex); } #endregion int start = 1; #region dynamicbuffer.removerange buffer.RemoveRange(start, 5); #endregion #region dynamicbuffer.reserve buffer.EnsureCapacity(buffer.Capacity + 10); #endregion #region dynamicbuffer.resizeuninitialized buffer.ResizeUninitialized(buffer.Length + 10); #endregion #region dynamicbuffer.indexoperator for (int i = 0; i < buffer.Length; i++) { buffer[i] = i * i; } #endregion #region dynamicbuffer.tonativearray NativeArray <int> copy = buffer.ToNativeArray(Allocator.Persistent); #endregion #region dynamicbuffer.trimexcess if (buffer.Capacity > buffer.Length) { buffer.TrimExcess(); } #endregion }
public static bool ValuesEqual <T>(this DynamicBuffer <T> buffer, DynamicBuffer <T> other) where T : struct, IBufferElementData, IEquatable <T> => buffer.AsNativeArray().ValuesEqual(other.AsNativeArray());
public static void Sort <T>(this DynamicBuffer <T> buffer) where T : struct, IBufferElementData, IComparable <T> { buffer.AsNativeArray().Sort(); }
NativeArray <AdjacentCell> GetAdjacentCellArray(Entity sectorEntity) { DynamicBuffer <AdjacentCell> adjacentCells = entityManager.GetBuffer <AdjacentCell>(sectorEntity); return(new NativeArray <AdjacentCell>(adjacentCells.AsNativeArray(), Allocator.Temp)); }