com.wallstop-studios.unity-helpers 2.0.0-rc42 → 2.0.0-rc44

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.
Files changed (38) hide show
  1. package/Editor/AnimationCopier.cs +1 -1
  2. package/Editor/AnimationCreator.cs +1 -1
  3. package/Editor/{EnsureTextureSizeWizard.cs → FitTextureSizeWizard.cs} +47 -15
  4. package/Editor/PrefabCheckWizard.cs +30 -25
  5. package/Editor/SpriteSettingsApplier.cs +130 -26
  6. package/Editor/TextureSettingsApplier.cs +7 -0
  7. package/Editor/WShowIfPropertyDrawer.cs +63 -0
  8. package/Editor/WShowIfPropertyDrawer.cs.meta +3 -0
  9. package/README.md +16 -0
  10. package/Runtime/Core/Attributes/WShowIfAttribute.cs +16 -0
  11. package/Runtime/Core/Attributes/WShowIfAttribute.cs.meta +3 -0
  12. package/Runtime/Core/Extension/ColorExtensions.cs +378 -87
  13. package/Runtime/Core/Extension/SerializedPropertyExtensions.cs +157 -0
  14. package/Runtime/Core/Extension/SerializedPropertyExtensions.cs.meta +3 -0
  15. package/Runtime/Core/Helper/FormattingHelpers.cs +32 -0
  16. package/Runtime/Core/Helper/FormattingHelpers.cs.meta +3 -0
  17. package/Runtime/Core/Helper/Objects.cs +4 -2
  18. package/Runtime/Core/Helper/Partials/TransformHelpers.cs +0 -1
  19. package/Runtime/Core/Random/AbstractRandom.cs +6 -5
  20. package/Runtime/Core/Random/DotNetRandom.cs +2 -0
  21. package/Runtime/Core/Random/IRandom.cs +1 -0
  22. package/Runtime/Core/Random/LinearCongruentialGenerator.cs +49 -0
  23. package/Runtime/Core/Random/LinearCongruentialGenerator.cs.meta +3 -0
  24. package/Runtime/Core/Random/PcgRandom.cs +1 -1
  25. package/Runtime/Core/Random/RomuDuo.cs +1 -1
  26. package/Runtime/Core/Random/SplitMix64.cs +1 -1
  27. package/Runtime/Core/Random/SystemRandom.cs +1 -1
  28. package/Runtime/Core/Random/WyRandom.cs +1 -1
  29. package/Runtime/Core/Random/XorShiftRandom.cs +13 -8
  30. package/Runtime/Core/Random/XorShiroRandom.cs +2 -0
  31. package/Runtime/Core/Threading/SingleThreadedThreadPool.cs +44 -35
  32. package/Runtime/UI/LayeredImage.cs +2 -2
  33. package/Runtime/Utils/SpriteRendererMetadata.cs +104 -42
  34. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +21 -3
  35. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs +12 -0
  36. package/Tests/Runtime/Random/LinearCongruentialGeneratorTests.cs.meta +3 -0
  37. package/package.json +1 -1
  38. /package/Editor/{EnsureTextureSizeWizard.cs.meta → FitTextureSizeWizard.cs.meta} +0 -0
@@ -43,7 +43,7 @@
43
43
  }
44
44
  }
45
45
 
46
- [MenuItem("Tools/Unity Helpers/Animation Copier")]
46
+ [MenuItem("Tools/Unity Helpers/Animation Copier", priority = -2)]
47
47
  public static void CopyAnimations()
48
48
  {
49
49
  _ = DisplayWizard<AnimationCopier>("Animation Copier", "Copy");
@@ -25,7 +25,7 @@
25
25
  public List<Object> animationSources = new();
26
26
  public string text;
27
27
 
28
- [MenuItem("Tools/Unity Helpers/Animation Creator")]
28
+ [MenuItem("Tools/Unity Helpers/Animation Creator", priority = -3)]
29
29
  public static void CreateAnimation()
30
30
  {
31
31
  _ = DisplayWizard<AnimationCreator>("Animation Creator", "Create");
@@ -6,16 +6,24 @@
6
6
  using UnityEditor;
7
7
  using UnityEngine;
8
8
 
9
- public sealed class EnsureTextureSizeWizard : ScriptableWizard
9
+ public enum FitMode
10
10
  {
11
+ GrowAndShrink = 0,
12
+ GrowOnly = 1,
13
+ ShrinkOnly = 2,
14
+ }
15
+
16
+ public sealed class FitTextureSizeWizard : ScriptableWizard
17
+ {
18
+ public FitMode fitMode = FitMode.GrowAndShrink;
11
19
  public List<Texture2D> textures = new();
12
20
 
13
21
  public List<Object> textureSourcePaths = new();
14
22
 
15
- [MenuItem("Tools/Unity Helpers/Ensure Texture Size")]
23
+ [MenuItem("Tools/Unity Helpers/Fit Texture Size", priority = -1)]
16
24
  public static void EnsureSizes()
17
25
  {
18
- _ = DisplayWizard<EnsureTextureSizeWizard>("Ensure Texture Size", "Run");
26
+ _ = DisplayWizard<FitTextureSizeWizard>("Fit Texture Size", "Run");
19
27
  }
20
28
 
21
29
  private void OnWizardCreate()
@@ -68,36 +76,60 @@
68
76
  }
69
77
 
70
78
  int changedCount = 0;
71
- foreach (Texture2D inputTexture in textures)
79
+ foreach (Texture2D texture in textures)
72
80
  {
73
- Texture2D texture = inputTexture;
74
81
  string assetPath = AssetDatabase.GetAssetPath(texture);
75
82
  if (string.IsNullOrWhiteSpace(assetPath))
76
83
  {
77
84
  continue;
78
85
  }
79
86
 
80
- TextureImporter tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
81
- if (tImporter == null)
87
+ TextureImporter textureImporter =
88
+ AssetImporter.GetAtPath(assetPath) as TextureImporter;
89
+ if (textureImporter == null)
82
90
  {
83
91
  continue;
84
92
  }
85
- tImporter.GetSourceTextureWidthAndHeight(out int width, out int height);
93
+ textureImporter.GetSourceTextureWidthAndHeight(out int width, out int height);
86
94
 
87
95
  float size = Mathf.Max(width, height);
88
- int textureSize = tImporter.maxTextureSize;
96
+ int textureSize = textureImporter.maxTextureSize;
97
+ int originalTextureSize = textureSize;
89
98
  bool changed = false;
90
- while (textureSize < size)
99
+ if (fitMode is FitMode.GrowAndShrink or FitMode.GrowOnly)
91
100
  {
92
- changed = true;
93
- textureSize <<= 1;
101
+ while (textureSize < size)
102
+ {
103
+ changed = true;
104
+ textureSize <<= 1;
105
+ }
94
106
  }
95
- tImporter.maxTextureSize = textureSize;
107
+
108
+ if (fitMode is FitMode.GrowAndShrink or FitMode.ShrinkOnly)
109
+ {
110
+ while (0 < textureSize && size <= (textureSize >> 1))
111
+ {
112
+ changed = true;
113
+ textureSize >>= 1;
114
+ }
115
+ }
116
+
117
+ textureImporter.maxTextureSize = textureSize;
96
118
 
97
119
  if (changed)
98
120
  {
99
- changedCount++;
100
- tImporter.SaveAndReimport();
121
+ ++changedCount;
122
+ textureImporter.SaveAndReimport();
123
+ if (textureImporter.maxTextureSize != textureSize)
124
+ {
125
+ this.LogError(
126
+ $"Failed to update {texture.name}, need texture size {textureSize} but got {textureImporter.maxTextureSize}. Path: '{assetPath}'."
127
+ );
128
+ if (originalTextureSize != textureImporter.maxTextureSize)
129
+ {
130
+ --changedCount;
131
+ }
132
+ }
101
133
  }
102
134
  }
103
135
 
@@ -23,7 +23,7 @@
23
23
  )]
24
24
  public List<Object> assetPaths = new();
25
25
 
26
- [MenuItem("Tools/Unity Helpers/Prefab Check Wizard")]
26
+ [MenuItem("Tools/Unity Helpers/Prefab Check Wizard", priority = -1)]
27
27
  public static void CreatePrefabCheckWizard()
28
28
  {
29
29
  _ = DisplayWizard<PrefabCheckWizard>("Prefab sanity check", "Run");
@@ -34,7 +34,10 @@
34
34
  List<string> parsedAssetPaths;
35
35
  if (assetPaths is { Count: > 0 })
36
36
  {
37
- parsedAssetPaths = assetPaths.Select(AssetDatabase.GetAssetPath).ToList();
37
+ parsedAssetPaths = assetPaths
38
+ .Where(Objects.NotNull)
39
+ .Select(AssetDatabase.GetAssetPath)
40
+ .ToList();
38
41
  parsedAssetPaths.RemoveAll(string.IsNullOrEmpty);
39
42
  if (parsedAssetPaths.Count <= 0)
40
43
  {
@@ -102,29 +105,6 @@
102
105
  )
103
106
  )
104
107
  {
105
- bool LogIfNull(object thing, int? position = null)
106
- {
107
- if (thing == null || (thing is Object unityThing && !unityThing))
108
- {
109
- if (position == null)
110
- {
111
- component.LogError("Field {0} has a null element in it.", field.Name);
112
- }
113
- else
114
- {
115
- component.LogError(
116
- "Field {0} has a null element at position {1}.",
117
- field.Name,
118
- position
119
- );
120
- }
121
-
122
- return true;
123
- }
124
-
125
- return false;
126
- }
127
-
128
108
  object fieldValue = field.GetValue(component);
129
109
 
130
110
  if (field.FieldType.IsArray)
@@ -158,6 +138,31 @@
158
138
  {
159
139
  _ = LogIfNull(thing, position++);
160
140
  }
141
+
142
+ continue;
143
+
144
+ bool LogIfNull(object thing, int? position = null)
145
+ {
146
+ if (thing == null || (thing is Object unityThing && !unityThing))
147
+ {
148
+ if (position == null)
149
+ {
150
+ component.LogError("Field {0} has a null element in it.", field.Name);
151
+ }
152
+ else
153
+ {
154
+ component.LogError(
155
+ "Field {0} has a null element at position {1}.",
156
+ field.Name,
157
+ position
158
+ );
159
+ }
160
+
161
+ return true;
162
+ }
163
+
164
+ return false;
165
+ }
161
166
  }
162
167
  }
163
168
  }
@@ -5,7 +5,9 @@
5
5
  using System.Collections.Generic;
6
6
  using System.IO;
7
7
  using System.Linq;
8
+ using Core.Attributes;
8
9
  using Core.Extension;
10
+ using Core.Helper;
9
11
  using UnityEditor;
10
12
  using UnityEngine;
11
13
  using Object = UnityEngine.Object;
@@ -13,14 +15,53 @@
13
15
  [Serializable]
14
16
  public sealed class SpriteSettings
15
17
  {
18
+ public bool applyPixelsPerUnit;
19
+
20
+ [WShowIf(nameof(applyPixelsPerUnit))]
16
21
  public int pixelsPerUnit = 100;
22
+
23
+ public bool applyPivot;
24
+
25
+ [WShowIf(nameof(applyPivot))]
17
26
  public Vector2 pivot = new(0.5f, 0.5f);
27
+
28
+ public bool applySpriteMode;
29
+
30
+ [WShowIf(nameof(applySpriteMode))]
18
31
  public SpriteImportMode spriteMode = SpriteImportMode.Single;
19
- public bool applyWrapMode = true;
32
+
33
+ public bool applyGenerateMipMaps;
34
+
35
+ [WShowIf(nameof(applyGenerateMipMaps))]
36
+ public bool generateMipMaps;
37
+
38
+ public bool applyAlphaIsTransparency;
39
+
40
+ [WShowIf(nameof(applyAlphaIsTransparency))]
41
+ public bool alphaIsTransparency = true;
42
+
43
+ public bool applyReadWriteEnabled;
44
+
45
+ [WShowIf(nameof(applyReadWriteEnabled))]
46
+ public bool readWriteEnabled = true;
47
+
48
+ public bool applyExtrudeEdges;
49
+
50
+ [WShowIf(nameof(applyExtrudeEdges))]
51
+ [Range(0, 32)]
52
+ public uint extrudeEdges = 1;
53
+
54
+ public bool applyWrapMode;
55
+
56
+ [WShowIf(nameof(applyWrapMode))]
20
57
  public TextureWrapMode wrapMode = TextureWrapMode.Clamp;
21
- public bool applyFilterMode = true;
58
+
59
+ public bool applyFilterMode;
60
+
61
+ [WShowIf(nameof(applyFilterMode))]
22
62
  public FilterMode filterMode = FilterMode.Point;
23
- public string name;
63
+
64
+ public string name = string.Empty;
24
65
  }
25
66
 
26
67
  public sealed class SpriteSettingsApplier : ScriptableWizard
@@ -38,7 +79,7 @@
38
79
  )]
39
80
  public List<Object> directories = new();
40
81
 
41
- [MenuItem("Tools/Unity Helpers/Sprite Settings Applier")]
82
+ [MenuItem("Tools/Unity Helpers/Sprite Settings Applier", priority = -2)]
42
83
  public static void CreateAnimation()
43
84
  {
44
85
  _ = DisplayWizard<SpriteSettingsApplier>("Sprite Settings Directory Applier", "Set");
@@ -47,9 +88,13 @@
47
88
  private void OnWizardCreate()
48
89
  {
49
90
  HashSet<string> uniqueDirectories = new();
50
- foreach (Object directory in directories)
91
+ foreach (
92
+ string assetPath in directories
93
+ .Where(Objects.NotNull)
94
+ .Select(AssetDatabase.GetAssetPath)
95
+ .Where(assetPath => !string.IsNullOrWhiteSpace(assetPath))
96
+ )
51
97
  {
52
- string assetPath = AssetDatabase.GetAssetPath(directory);
53
98
  if (Directory.Exists(assetPath))
54
99
  {
55
100
  _ = uniqueDirectories.Add(assetPath);
@@ -59,9 +104,8 @@
59
104
  HashSet<string> processedSpritePaths = new();
60
105
  Queue<string> directoriesToCheck = new(uniqueDirectories);
61
106
  int spriteCount = 0;
62
- while (0 < directoriesToCheck.Count)
107
+ while (directoriesToCheck.TryDequeue(out string directoryPath))
63
108
  {
64
- string directoryPath = directoriesToCheck.Dequeue();
65
109
  foreach (string fullFilePath in Directory.EnumerateFiles(directoryPath))
66
110
  {
67
111
  if (!spriteFileExtensions.Contains(Path.GetExtension(fullFilePath)))
@@ -102,14 +146,13 @@
102
146
  }
103
147
  }
104
148
 
105
- foreach (Sprite sprite in sprites)
149
+ foreach (
150
+ string filePath in sprites
151
+ .Where(Objects.NotNull)
152
+ .Select(AssetDatabase.GetAssetPath)
153
+ .Where(Objects.NotNull)
154
+ )
106
155
  {
107
- if (sprite == null)
108
- {
109
- continue;
110
- }
111
-
112
- string filePath = AssetDatabase.GetAssetPath(sprite);
113
156
  if (
114
157
  processedSpritePaths.Add(Application.dataPath + filePath)
115
158
  && TryUpdateTextureSettings(filePath)
@@ -128,40 +171,101 @@
128
171
 
129
172
  private bool TryUpdateTextureSettings(string filePath)
130
173
  {
174
+ bool changed = false;
175
+ if (string.IsNullOrWhiteSpace(filePath))
176
+ {
177
+ return changed;
178
+ }
179
+
131
180
  TextureImporter textureImporter = AssetImporter.GetAtPath(filePath) as TextureImporter;
132
181
  if (textureImporter == null)
133
182
  {
134
- return false;
183
+ return changed;
135
184
  }
136
185
 
137
- SpriteSettings spriteData = spriteSettings.FirstOrDefault(settings =>
138
- string.IsNullOrEmpty(settings.name) || filePath.Contains(settings.name)
186
+ SpriteSettings spriteData = spriteSettings.Find(settings =>
187
+ string.IsNullOrWhiteSpace(settings.name) || filePath.Contains(settings.name)
139
188
  );
140
189
  if (spriteData == null)
141
190
  {
142
- return false;
191
+ return changed;
192
+ }
193
+
194
+ if (spriteData.applyPixelsPerUnit)
195
+ {
196
+ // ReSharper disable once CompareOfFloatsByEqualityOperator
197
+ changed |= textureImporter.spritePixelsPerUnit != spriteData.pixelsPerUnit;
198
+ textureImporter.spritePixelsPerUnit = spriteData.pixelsPerUnit;
143
199
  }
144
200
 
145
- textureImporter.spritePivot = spriteData.pivot;
146
- textureImporter.spritePixelsPerUnit = spriteData.pixelsPerUnit;
201
+ if (spriteData.applyPivot)
202
+ {
203
+ changed |= textureImporter.spritePivot != spriteData.pivot;
204
+ textureImporter.spritePivot = spriteData.pivot;
205
+ }
147
206
 
207
+ if (spriteData.applyGenerateMipMaps)
208
+ {
209
+ changed |= textureImporter.mipmapEnabled != spriteData.generateMipMaps;
210
+ textureImporter.mipmapEnabled = spriteData.generateMipMaps;
211
+ }
212
+
213
+ bool changedSettings = false;
148
214
  TextureImporterSettings settings = new();
149
215
  textureImporter.ReadTextureSettings(settings);
150
- settings.spriteAlignment = (int)SpriteAlignment.Custom;
151
- settings.spriteMode = (int)spriteData.spriteMode;
216
+ if (spriteData.applyPivot)
217
+ {
218
+ changedSettings |= settings.spriteAlignment != (int)SpriteAlignment.Custom;
219
+ settings.spriteAlignment = (int)SpriteAlignment.Custom;
220
+ }
221
+
222
+ if (spriteData.applyAlphaIsTransparency)
223
+ {
224
+ changedSettings |= settings.alphaIsTransparency != spriteData.alphaIsTransparency;
225
+ settings.alphaIsTransparency = spriteData.alphaIsTransparency;
226
+ }
227
+
228
+ if (spriteData.applyReadWriteEnabled)
229
+ {
230
+ changedSettings |= settings.readable != spriteData.readWriteEnabled;
231
+ settings.readable = spriteData.readWriteEnabled;
232
+ }
233
+
234
+ if (spriteData.applySpriteMode)
235
+ {
236
+ changedSettings |= settings.spriteMode != (int)spriteData.spriteMode;
237
+ settings.spriteMode = (int)spriteData.spriteMode;
238
+ }
239
+
240
+ if (spriteData.applyExtrudeEdges)
241
+ {
242
+ changedSettings |= settings.spriteExtrude != spriteData.extrudeEdges;
243
+ settings.spriteExtrude = spriteData.extrudeEdges;
244
+ }
245
+
152
246
  if (spriteData.applyWrapMode)
153
247
  {
248
+ changedSettings |= settings.wrapMode != spriteData.wrapMode;
154
249
  settings.wrapMode = spriteData.wrapMode;
155
250
  }
156
251
 
157
252
  if (spriteData.applyFilterMode)
158
253
  {
254
+ changedSettings |= settings.filterMode != spriteData.filterMode;
159
255
  settings.filterMode = spriteData.filterMode;
160
256
  }
161
257
 
162
- textureImporter.SetTextureSettings(settings);
163
- textureImporter.SaveAndReimport();
164
- return true;
258
+ if (changedSettings)
259
+ {
260
+ textureImporter.SetTextureSettings(settings);
261
+ }
262
+ changed |= changedSettings;
263
+ if (changed)
264
+ {
265
+ textureImporter.SaveAndReimport();
266
+ }
267
+
268
+ return changed;
165
269
  }
166
270
  }
167
271
  #endif
@@ -5,6 +5,7 @@
5
5
  using System.Collections.Generic;
6
6
  using System.IO;
7
7
  using System.Linq;
8
+ using Core.Attributes;
8
9
  using Core.Extension;
9
10
  using UnityEditor;
10
11
  using UnityEngine;
@@ -18,9 +19,15 @@
18
19
  public bool applyMipMaps = false;
19
20
  public bool generateMipMaps = false;
20
21
  public bool applyWrapMode = false;
22
+
23
+ [WShowIf(nameof(applyWrapMode))]
21
24
  public TextureWrapMode wrapMode = TextureWrapMode.Clamp;
25
+
22
26
  public bool applyFilterMode = false;
27
+
28
+ [WShowIf(nameof(applyFilterMode))]
23
29
  public FilterMode filterMode = FilterMode.Trilinear;
30
+
24
31
  public TextureImporterCompression compression = TextureImporterCompression.CompressedHQ;
25
32
  public bool useCrunchCompression = true;
26
33
  public TextureResizeAlgorithm textureResizeAlgorithm = TextureResizeAlgorithm.Bilinear;
@@ -0,0 +1,63 @@
1
+ namespace UnityHelpers.Editor
2
+ {
3
+ #if UNITY_EDITOR
4
+ using System.Reflection;
5
+ using Core.Attributes;
6
+ using Core.Extension;
7
+ using UnityEngine;
8
+ using UnityEditor;
9
+
10
+ [CustomPropertyDrawer(typeof(WShowIfAttribute))]
11
+ public sealed class WShowIfPropertyDrawer : PropertyDrawer
12
+ {
13
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
14
+ {
15
+ return !ShouldShow(property) ? 0f : EditorGUI.GetPropertyHeight(property, label, true);
16
+ }
17
+
18
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
19
+ {
20
+ if (ShouldShow(property))
21
+ {
22
+ EditorGUI.PropertyField(position, property, label, true);
23
+ }
24
+ }
25
+
26
+ private bool ShouldShow(SerializedProperty property)
27
+ {
28
+ if (attribute is not WShowIfAttribute showIf)
29
+ {
30
+ return true;
31
+ }
32
+
33
+ SerializedProperty conditionProperty = property.serializedObject.FindProperty(
34
+ showIf.conditionField
35
+ );
36
+ if (conditionProperty is not { propertyType: SerializedPropertyType.Boolean })
37
+ {
38
+ if (conditionProperty != null)
39
+ {
40
+ return true;
41
+ }
42
+
43
+ // This might not be a unity object, so fall back to reflection
44
+ object enclosingObject = property.GetEnclosingObject(out _);
45
+ FieldInfo conditionField = enclosingObject
46
+ ?.GetType()
47
+ .GetField(
48
+ showIf.conditionField,
49
+ BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
50
+ );
51
+ if (conditionField?.GetValue(enclosingObject) is bool maybeCondition)
52
+ {
53
+ return showIf.inverse ? !maybeCondition : maybeCondition;
54
+ }
55
+ return true;
56
+ }
57
+
58
+ bool condition = conditionProperty.boolValue;
59
+ return showIf.inverse ? !condition : condition;
60
+ }
61
+ }
62
+ #endif
63
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 69dba17ab0994516865a375df33919f5
3
+ timeCreated: 1742505739
package/README.md CHANGED
@@ -129,6 +129,22 @@ random.NextNoiseMap(width, height); // A configurable noise map generated using
129
129
  - XorShift
130
130
  - XorShiro
131
131
 
132
+ ## Performance (Number of Operations / Second)
133
+
134
+ | Random | NextBool | Next | NextUInt | NextFloat | NextDouble | NextUint - Range | NextInt - Range |
135
+ | ------ | -------- | ---- | -------- | --------- | ---------- | ---------------- | --------------- |
136
+ | PcgRandom | 34,260,478 | 34,303,866 | 35,148,246 | 24,818,438 | 30,034,632 |22,436,474 |20,801,797 |
137
+ | SystemRandom | 28,698,806 | 30,040,782 | 20,435,092 | 24,079,399 | 27,284,147 |20,735,769 |19,861,780 |
138
+ | SquirrelRandom | 33,285,784 | 33,439,909 | 34,611,893 | 23,885,731 | 28,958,725 |21,520,279 |20,311,372 |
139
+ | XorShiftRandom | 34,695,989 | 35,147,320 | 35,997,718 | 25,248,238 | 31,582,991 |22,679,928 |21,255,319 |
140
+ | DotNetRandom | 18,097,489 | 18,191,042 | 18,783,063 | 14,061,444 | 15,730,439 |13,284,050 |12,596,913 |
141
+ | WyRandom | 28,490,852 | 29,086,052 | 29,724,907 | 20,252,065 | 24,542,201 |18,474,790 |17,404,641 |
142
+ | SplitMix64 | 34,301,843 | 34,343,404 | 35,512,284 | 24,289,416 | 30,586,231 |22,470,330 |20,850,965 |
143
+ | RomuDuo | 32,969,889 | 33,413,212 | 34,339,227 | 23,755,059 | 29,483,136 |21,671,641 |20,253,479 |
144
+ | XorShiroRandom | 31,529,025 | 31,717,709 | 32,536,277 | 22,421,715 | 27,619,417 |20,843,993 |19,270,063 |
145
+ | UnityRandom | 24,925,268 | 24,830,594 | 26,429,283 | 17,864,528 | 21,206,384 |16,376,626 |15,528,972 |
146
+ | LinearCongruentialGenerator | 35,013,818 | 35,025,182 | 35,843,533 | 25,093,401 | 31,553,487 |22,579,798 |21,211,175 |
147
+
132
148
  # Spatial Trees
133
149
  There are three implemented 2D immutable spatial trees that can store generic objects, as long as there is some resolution function that can convert them into Vector2 spatial positions.
134
150
 
@@ -0,0 +1,16 @@
1
+ namespace UnityHelpers.Core.Attributes
2
+ {
3
+ using UnityEngine;
4
+
5
+ public sealed class WShowIfAttribute : PropertyAttribute
6
+ {
7
+ public readonly string conditionField;
8
+ public readonly bool inverse;
9
+
10
+ public WShowIfAttribute(string conditionField, bool inverse = false)
11
+ {
12
+ this.conditionField = conditionField;
13
+ this.inverse = inverse;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a8f5bc1c74414b2aaed62f49ae205f0b
3
+ timeCreated: 1742505715