com.wallstop-studios.unity-helpers 2.0.0-rc79.1 → 2.0.0-rc79.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
1
  namespace WallstopStudios.UnityHelpers.Core.Helper
2
2
  {
3
3
  using System;
4
+ using System.Text;
5
+ using WallstopStudios.UnityHelpers.Utils;
4
6
 
5
7
  public static class FormattingHelpers
6
8
  {
@@ -26,7 +28,11 @@
26
28
  }
27
29
  }
28
30
 
29
- return $"{len:0.##} {ByteSizes[order]}";
31
+ StringBuilder stringBuilder = Buffers.StringBuilder;
32
+ stringBuilder.Clear();
33
+ stringBuilder.AppendFormat("{0:0.##} ", len);
34
+ stringBuilder.Append(ByteSizes[order]);
35
+ return stringBuilder.ToString();
30
36
  }
31
37
  }
32
38
  }
@@ -1,6 +1,7 @@
1
1
  namespace WallstopStudios.UnityHelpers.Utils
2
2
  {
3
3
  using System.Collections.Generic;
4
+ using System.Text;
4
5
  using UnityEngine;
5
6
 
6
7
  public static class Buffers
@@ -20,10 +21,13 @@
20
21
  public static readonly System.Random Random = new();
21
22
  public static readonly WaitForFixedUpdate WaitForFixedUpdate = new();
22
23
  public static readonly WaitForEndOfFrame WaitForEndOfFrame = new();
24
+
25
+ public static readonly StringBuilder StringBuilder = new();
23
26
  }
24
27
 
25
28
  public static class Buffers<T>
26
29
  {
30
+ public static readonly T[] Array = new T[Buffers.BufferSize];
27
31
  public static readonly List<T> List = new();
28
32
  public static readonly HashSet<T> HashSet = new();
29
33
  public static readonly Queue<T> Queue = new();
@@ -1,5 +1,7 @@
1
1
  namespace WallstopStudios.UnityHelpers.Utils
2
2
  {
3
+ using System;
4
+ using System.Collections.Generic;
3
5
  using Core.Attributes;
4
6
  using Core.Extension;
5
7
  using Core.Helper;
@@ -34,6 +36,8 @@
34
36
 
35
37
  private Coroutine _update;
36
38
 
39
+ private readonly Dictionary<int, Vector3[]> _cachedSegments = new();
40
+
37
41
  private void Awake()
38
42
  {
39
43
  this.AssignSiblingComponents();
@@ -114,7 +118,13 @@
114
118
  float angle = 360f / numSegments;
115
119
  float offsetRadians = PRNG.Instance.NextFloat(angle);
116
120
  float currentOffset = offsetRadians;
117
- Vector3[] positions = new Vector3[numSegments];
121
+ if (!_cachedSegments.TryGetValue(numSegments, out Vector3[] positions))
122
+ {
123
+ positions = new Vector3[numSegments];
124
+ _cachedSegments[numSegments] = positions;
125
+ }
126
+
127
+ Array.Clear(positions, 0, numSegments);
118
128
  for (int i = 0; i < numSegments; ++i)
119
129
  {
120
130
  positions[i] =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc79.1",
3
+ "version": "2.0.0-rc79.2",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -45,3 +45,4 @@
45
45
 
46
46
 
47
47
 
48
+