com.wallstop-studios.unity-helpers 2.1.0 → 2.1.1

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 (52) hide show
  1. package/Docs/ILIST_SORTING_PERFORMANCE.md +92 -0
  2. package/Docs/ILIST_SORTING_PERFORMANCE.md.meta +7 -0
  3. package/Docs/INDEX.md +10 -1
  4. package/Docs/Images/random_generators.svg +7 -7
  5. package/Docs/RANDOM_PERFORMANCE.md +17 -14
  6. package/Docs/SPATIAL_TREE_2D_PERFORMANCE.md +64 -64
  7. package/Docs/SPATIAL_TREE_3D_PERFORMANCE.md +64 -64
  8. package/Editor/Core/Helper/AnimationEventHelpers.cs +1 -1
  9. package/README.md +25 -15
  10. package/Runtime/Core/Extension/IListExtensions.cs +720 -12
  11. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +2 -3
  12. package/Runtime/Core/Random/AbstractRandom.cs +52 -5
  13. package/Runtime/Core/Random/DotNetRandom.cs +3 -3
  14. package/Runtime/Core/Random/FlurryBurstRandom.cs +285 -0
  15. package/Runtime/Core/Random/FlurryBurstRandom.cs.meta +3 -0
  16. package/Runtime/Core/Random/IllusionFlow.cs +3 -3
  17. package/Runtime/Core/Random/LinearCongruentialGenerator.cs +3 -3
  18. package/Runtime/Core/Random/PcgRandom.cs +6 -6
  19. package/Runtime/Core/Random/PhotonSpinRandom.cs +387 -0
  20. package/Runtime/Core/Random/PhotonSpinRandom.cs.meta +3 -0
  21. package/Runtime/Core/Random/RomuDuo.cs +3 -3
  22. package/Runtime/Core/Random/SplitMix64.cs +3 -3
  23. package/Runtime/Core/Random/SquirrelRandom.cs +6 -4
  24. package/Runtime/Core/Random/StormDropRandom.cs +271 -0
  25. package/Runtime/Core/Random/StormDropRandom.cs.meta +3 -0
  26. package/Runtime/Core/Random/UnityRandom.cs +3 -3
  27. package/Runtime/Core/Random/WyRandom.cs +6 -4
  28. package/Runtime/Core/Random/XorShiftRandom.cs +3 -3
  29. package/Runtime/Core/Random/XoroShiroRandom.cs +3 -3
  30. package/Runtime/Tags/AttributeMetadataCache.cs +312 -3
  31. package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs +192 -0
  32. package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs.meta +11 -0
  33. package/Tests/Editor/Tags.meta +8 -0
  34. package/Tests/Runtime/Extensions/IListExtensionTests.cs +187 -1
  35. package/Tests/Runtime/Helper/ObjectsTests.cs +3 -3
  36. package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs +2 -2
  37. package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs +346 -0
  38. package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs.meta +11 -0
  39. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +3 -0
  40. package/Tests/Runtime/Random/FlurryBurstRandomTests.cs +12 -0
  41. package/Tests/Runtime/Random/FlurryBurstRandomTests.cs.meta +3 -0
  42. package/Tests/Runtime/Random/PhotonSpinRandomTests.cs +12 -0
  43. package/Tests/Runtime/Random/PhotonSpinRandomTests.cs.meta +3 -0
  44. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs +14 -0
  45. package/Tests/Runtime/Random/RandomTestBase.cs +39 -4
  46. package/Tests/Runtime/Random/StormDropRandomTests.cs +12 -0
  47. package/Tests/Runtime/Random/StormDropRandomTests.cs.meta +3 -0
  48. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs +2 -2
  49. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs +1 -1
  50. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs +1 -1
  51. package/Tests/Runtime/Tags/PeriodicEffectDefinitionSerializationTests.cs +2 -2
  52. package/package.json +1 -1
@@ -0,0 +1,346 @@
1
+ namespace WallstopStudios.UnityHelpers.Tests.Performance
2
+ {
3
+ using System;
4
+ using System.Collections.Generic;
5
+ using System.Diagnostics;
6
+ using System.Globalization;
7
+ using System.Text;
8
+ using NUnit.Framework;
9
+ using UnityEngine;
10
+ using WallstopStudios.UnityHelpers.Core.Extension;
11
+ using WallstopStudios.UnityHelpers.Core.Random;
12
+
13
+ public sealed class IListSortingPerformanceTests
14
+ {
15
+ private const string DocumentPath = "Docs/ILIST_SORTING_PERFORMANCE.md";
16
+ private const string SectionPrefix = "ILIST_SORT_";
17
+ private const int NearlySortedSwapPercentage = 50;
18
+
19
+ private static readonly DatasetSizeSpec[] DatasetSizeSpecs =
20
+ {
21
+ new DatasetSizeSpec("100", 100),
22
+ new DatasetSizeSpec("1,000", 1_000),
23
+ new DatasetSizeSpec("10,000", 10_000),
24
+ new DatasetSizeSpec("100,000", 100_000),
25
+ new DatasetSizeSpec("1,000,000", 1_000_000),
26
+ };
27
+
28
+ private static readonly DatasetState[] DatasetStates =
29
+ {
30
+ new DatasetState("Sorted", BuildSortedData),
31
+ new DatasetState("Nearly Sorted (2% swaps)", BuildNearlySortedData),
32
+ new DatasetState("Shuffled (deterministic)", BuildShuffledData),
33
+ };
34
+
35
+ private static readonly SortImplementation[] SortImplementations =
36
+ {
37
+ new SortImplementation("Ghost", SortAlgorithm.Ghost, false, int.MaxValue),
38
+ new SortImplementation("Meteor", SortAlgorithm.Meteor, false, int.MaxValue),
39
+ new SortImplementation(
40
+ "Pattern-Defeating QuickSort",
41
+ SortAlgorithm.PatternDefeatingQuickSort,
42
+ false,
43
+ int.MaxValue
44
+ ),
45
+ new SortImplementation("Grail", SortAlgorithm.Grail, true, int.MaxValue),
46
+ new SortImplementation("Power", SortAlgorithm.Power, true, int.MaxValue),
47
+ new SortImplementation("Insertion", SortAlgorithm.Insertion, true, 10_000),
48
+ };
49
+
50
+ [Test]
51
+ [Timeout(0)]
52
+ public void Benchmark()
53
+ {
54
+ string operatingSystemToken = GetOperatingSystemToken();
55
+ string sectionName = SectionPrefix + operatingSystemToken;
56
+
57
+ List<string> readmeLines = new List<string>
58
+ {
59
+ string.Format(
60
+ CultureInfo.InvariantCulture,
61
+ "_Last updated {0:yyyy-MM-dd HH:mm} UTC on {1}_",
62
+ DateTime.UtcNow,
63
+ SystemInfo.operatingSystem
64
+ ),
65
+ string.Empty,
66
+ "Times are single-pass measurements in milliseconds (lower is better). `n/a` indicates the algorithm was skipped for the dataset size.",
67
+ string.Empty,
68
+ };
69
+
70
+ IComparer<int> comparer = Comparer<int>.Default;
71
+ string headerLine = BuildHeaderLine();
72
+ string dividerLine = BuildDividerLine();
73
+
74
+ foreach (DatasetState datasetState in DatasetStates)
75
+ {
76
+ UnityEngine.Debug.Log($"IList Sorting Benchmarks - {datasetState.Label}");
77
+ UnityEngine.Debug.Log(headerLine);
78
+ UnityEngine.Debug.Log(dividerLine);
79
+
80
+ readmeLines.Add($"### {datasetState.Label}");
81
+ readmeLines.Add(headerLine);
82
+ readmeLines.Add(dividerLine);
83
+
84
+ foreach (DatasetSizeSpec sizeSpec in DatasetSizeSpecs)
85
+ {
86
+ int[] baseData = datasetState.CreateData(sizeSpec.Count);
87
+ string rowLine = BuildRowLine(sizeSpec.Label, baseData, comparer);
88
+ UnityEngine.Debug.Log(rowLine);
89
+ readmeLines.Add(rowLine);
90
+ }
91
+
92
+ readmeLines.Add(string.Empty);
93
+ UnityEngine.Debug.Log(string.Empty);
94
+ }
95
+
96
+ BenchmarkReadmeUpdater.UpdateSection(sectionName, readmeLines, DocumentPath);
97
+ }
98
+
99
+ private static string BuildHeaderLine()
100
+ {
101
+ StringBuilder headerBuilder = new StringBuilder();
102
+ headerBuilder.Append("| List Size |");
103
+ foreach (SortImplementation implementation in SortImplementations)
104
+ {
105
+ headerBuilder.Append(' ');
106
+ headerBuilder.Append(implementation.Label);
107
+ headerBuilder.Append(" |");
108
+ }
109
+
110
+ return headerBuilder.ToString();
111
+ }
112
+
113
+ private static string BuildDividerLine()
114
+ {
115
+ StringBuilder dividerBuilder = new StringBuilder();
116
+ dividerBuilder.Append("| --- |");
117
+ foreach (SortImplementation implementation in SortImplementations)
118
+ {
119
+ dividerBuilder.Append(" --- |");
120
+ }
121
+
122
+ return dividerBuilder.ToString();
123
+ }
124
+
125
+ private static string BuildRowLine(
126
+ string sizeLabel,
127
+ int[] baseData,
128
+ IComparer<int> comparer
129
+ )
130
+ {
131
+ StringBuilder rowBuilder = new StringBuilder();
132
+ rowBuilder.Append("| ");
133
+ rowBuilder.Append(sizeLabel);
134
+ rowBuilder.Append(" |");
135
+
136
+ foreach (SortImplementation implementation in SortImplementations)
137
+ {
138
+ string result = BenchmarkImplementation(implementation, baseData, comparer);
139
+ rowBuilder.Append(' ');
140
+ rowBuilder.Append(result);
141
+ rowBuilder.Append(" |");
142
+ }
143
+
144
+ return rowBuilder.ToString();
145
+ }
146
+
147
+ private static string BenchmarkImplementation(
148
+ SortImplementation implementation,
149
+ int[] baseData,
150
+ IComparer<int> comparer
151
+ )
152
+ {
153
+ if (baseData.Length > implementation.MaxSupportedCount)
154
+ {
155
+ return "n/a";
156
+ }
157
+
158
+ int[] workingData = new int[baseData.Length];
159
+ Array.Copy(baseData, workingData, baseData.Length);
160
+
161
+ IList<int> workingList = workingData;
162
+ Stopwatch stopwatch = Stopwatch.StartNew();
163
+
164
+ try
165
+ {
166
+ implementation.Execute(workingList, comparer);
167
+ }
168
+ catch (Exception exception)
169
+ {
170
+ UnityEngine.Debug.LogError(
171
+ $"Sorting benchmark failed for {implementation.Label}: {exception.Message}"
172
+ );
173
+ return "error";
174
+ }
175
+ finally
176
+ {
177
+ stopwatch.Stop();
178
+ }
179
+
180
+ double milliseconds = stopwatch.Elapsed.TotalMilliseconds;
181
+ return FormatDuration(milliseconds);
182
+ }
183
+
184
+ private static string FormatDuration(double milliseconds)
185
+ {
186
+ if (milliseconds >= 1000d)
187
+ {
188
+ double seconds = milliseconds / 1000d;
189
+ return string.Format(CultureInfo.InvariantCulture, "{0:0.00} s", seconds);
190
+ }
191
+
192
+ if (milliseconds >= 100d)
193
+ {
194
+ return string.Format(CultureInfo.InvariantCulture, "{0:0} ms", milliseconds);
195
+ }
196
+
197
+ if (milliseconds >= 10d)
198
+ {
199
+ return string.Format(CultureInfo.InvariantCulture, "{0:0.0} ms", milliseconds);
200
+ }
201
+
202
+ if (milliseconds >= 1d)
203
+ {
204
+ return string.Format(CultureInfo.InvariantCulture, "{0:0.00} ms", milliseconds);
205
+ }
206
+
207
+ return string.Format(CultureInfo.InvariantCulture, "{0:0.000} ms", milliseconds);
208
+ }
209
+
210
+ private static int[] BuildSortedData(int count)
211
+ {
212
+ int[] data = new int[count];
213
+ for (int i = 0; i < count; ++i)
214
+ {
215
+ data[i] = i;
216
+ }
217
+
218
+ return data;
219
+ }
220
+
221
+ private static int[] BuildNearlySortedData(int count)
222
+ {
223
+ int[] data = BuildSortedData(count);
224
+ if (count <= 1)
225
+ {
226
+ return data;
227
+ }
228
+
229
+ int swaps = Math.Max(1, count / NearlySortedSwapPercentage);
230
+ IRandom random = new PcgRandom(unchecked(count * 37));
231
+
232
+ for (int i = 0; i < swaps; ++i)
233
+ {
234
+ int index = random.Next(0, count - 1);
235
+ int neighbor = Math.Min(count - 1, index + 1);
236
+ int temp = data[index];
237
+ data[index] = data[neighbor];
238
+ data[neighbor] = temp;
239
+ }
240
+
241
+ return data;
242
+ }
243
+
244
+ private static int[] BuildShuffledData(int count)
245
+ {
246
+ int[] data = BuildSortedData(count);
247
+ if (count <= 1)
248
+ {
249
+ return data;
250
+ }
251
+
252
+ IRandom random = new PcgRandom(unchecked(count * 7919));
253
+
254
+ for (int i = count - 1; i > 0; --i)
255
+ {
256
+ int swapIndex = random.Next(0, i + 1);
257
+ int temp = data[i];
258
+ data[i] = data[swapIndex];
259
+ data[swapIndex] = temp;
260
+ }
261
+
262
+ return data;
263
+ }
264
+
265
+ private static string GetOperatingSystemToken()
266
+ {
267
+ RuntimePlatform platform = Application.platform;
268
+ switch (platform)
269
+ {
270
+ case RuntimePlatform.WindowsEditor:
271
+ case RuntimePlatform.WindowsPlayer:
272
+ case RuntimePlatform.WindowsServer:
273
+ return "WINDOWS";
274
+ case RuntimePlatform.OSXEditor:
275
+ case RuntimePlatform.OSXPlayer:
276
+ return "MACOS";
277
+ case RuntimePlatform.LinuxEditor:
278
+ case RuntimePlatform.LinuxPlayer:
279
+ case RuntimePlatform.LinuxServer:
280
+ return "LINUX";
281
+ default:
282
+ return "OTHER";
283
+ }
284
+ }
285
+
286
+ private readonly struct DatasetSizeSpec
287
+ {
288
+ public DatasetSizeSpec(string label, int count)
289
+ {
290
+ Label = label;
291
+ Count = count;
292
+ }
293
+
294
+ public string Label { get; }
295
+
296
+ public int Count { get; }
297
+ }
298
+
299
+ private readonly struct DatasetState
300
+ {
301
+ private readonly Func<int, int[]> generator;
302
+
303
+ public DatasetState(string label, Func<int, int[]> generator)
304
+ {
305
+ Label = label;
306
+ this.generator = generator;
307
+ }
308
+
309
+ public string Label { get; }
310
+
311
+ public int[] CreateData(int count)
312
+ {
313
+ return generator(count);
314
+ }
315
+ }
316
+
317
+ private readonly struct SortImplementation
318
+ {
319
+ public SortImplementation(
320
+ string label,
321
+ SortAlgorithm algorithm,
322
+ bool isStable,
323
+ int maxSupportedCount
324
+ )
325
+ {
326
+ Label = label;
327
+ Algorithm = algorithm;
328
+ IsStable = isStable;
329
+ MaxSupportedCount = maxSupportedCount;
330
+ }
331
+
332
+ public string Label { get; }
333
+
334
+ public SortAlgorithm Algorithm { get; }
335
+
336
+ public bool IsStable { get; }
337
+
338
+ public int MaxSupportedCount { get; }
339
+
340
+ public void Execute(IList<int> list, IComparer<int> comparer)
341
+ {
342
+ list.Sort(comparer, Algorithm);
343
+ }
344
+ }
345
+ }
346
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c840f3e2d6f3912498b363680b22a1b2
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -31,12 +31,15 @@ namespace WallstopStudios.UnityHelpers.Tests.Performance
31
31
  LogRow(RunTest(new PcgRandom(), timeout));
32
32
  LogRow(RunTest(new RomuDuo(), timeout));
33
33
  LogRow(RunTest(new SplitMix64(), timeout));
34
+ LogRow(RunTest(new FlurryBurstRandom(), timeout));
34
35
  LogRow(RunTest(new SquirrelRandom(), timeout));
35
36
  LogRow(RunTest(new SystemRandom(), timeout));
36
37
  LogRow(RunTest(new UnityRandom(), timeout));
37
38
  LogRow(RunTest(new WyRandom(), timeout));
38
39
  LogRow(RunTest(new XorShiftRandom(), timeout));
39
40
  LogRow(RunTest(new XoroShiroRandom(), timeout));
41
+ LogRow(RunTest(new PhotonSpinRandom(), timeout));
42
+ LogRow(RunTest(new StormDropRandom(), timeout));
40
43
 
41
44
  BenchmarkReadmeUpdater.UpdateSection(
42
45
  "RANDOM_BENCHMARKS",
@@ -0,0 +1,12 @@
1
+ namespace WallstopStudios.UnityHelpers.Tests.Random
2
+ {
3
+ using WallstopStudios.UnityHelpers.Core.Random;
4
+
5
+ public sealed class FlurryBurstRandomTests : RandomTestBase
6
+ {
7
+ protected override IRandom NewRandom()
8
+ {
9
+ return new FlurryBurstRandom();
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a8708ba817fc4d00a3ef31b68f550aba
3
+ timeCreated: 1761435962
@@ -0,0 +1,12 @@
1
+ namespace WallstopStudios.UnityHelpers.Tests.Random
2
+ {
3
+ using WallstopStudios.UnityHelpers.Core.Random;
4
+
5
+ public sealed class PhotonSpinRandomTests : RandomTestBase
6
+ {
7
+ protected override IRandom NewRandom()
8
+ {
9
+ return new PhotonSpinRandom();
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: d55cf2508f694064a195df1829686813
3
+ timeCreated: 1761435962
@@ -171,6 +171,20 @@ namespace WallstopStudios.UnityHelpers.Tests.Random
171
171
  Assert.AreEqual(random.InternalState.State2, deserialized.InternalState.State2);
172
172
  }
173
173
 
174
+ [Test]
175
+ public void PhotonSpinRandomSerializesAndDeserializes()
176
+ {
177
+ PhotonSpinRandom random = new(Guid.Parse("0AF7CF4F-44F6-421E-B7DC-1ADEF9F27E19"));
178
+ VerifySerializationAndGeneration(random);
179
+ }
180
+
181
+ [Test]
182
+ public void StormDropRandomSerializesAndDeserializes()
183
+ {
184
+ StormDropRandom random = new(987654321u);
185
+ VerifySerializationAndGeneration(random);
186
+ }
187
+
174
188
  [Test]
175
189
  public void UnityRandomSerializesAndDeserializes()
176
190
  {
@@ -514,19 +514,54 @@ namespace WallstopStudios.UnityHelpers.Tests.Random
514
514
 
515
515
  [Test]
516
516
  [Parallelizable]
517
- public void Json()
517
+ public void JsonSerialization()
518
518
  {
519
519
  IRandom random = NewRandom();
520
520
  string json = random.ToJson();
521
521
  IRandom deserialized = Serializer.JsonDeserialize<IRandom>(json, random.GetType());
522
522
  Assert.AreEqual(random.InternalState, deserialized.InternalState);
523
523
 
524
- if (NewRandom() is not UnityRandom)
524
+ if (random is not UnityRandom)
525
525
  {
526
526
  for (int i = 0; i < NumGeneratorChecks; ++i)
527
527
  {
528
- Assert.AreEqual(random.Next(), deserialized.Next());
529
- Assert.AreEqual(random.InternalState, deserialized.InternalState);
528
+ Assert.AreEqual(random.Next(), deserialized.Next(), "Iteration: " + i);
529
+ Assert.AreEqual(
530
+ random.InternalState,
531
+ deserialized.InternalState,
532
+ "Iteration: " + i
533
+ );
534
+ }
535
+ }
536
+ }
537
+
538
+ [Test]
539
+ [Parallelizable]
540
+ public void JsonSerializationWithMix()
541
+ {
542
+ for (int preMix = 1; preMix < 10; ++preMix)
543
+ {
544
+ IRandom random = NewRandom();
545
+ for (int j = 0; j < preMix; ++j)
546
+ {
547
+ _ = random.Next();
548
+ }
549
+
550
+ string json = random.ToJson();
551
+ IRandom deserialized = Serializer.JsonDeserialize<IRandom>(json, random.GetType());
552
+ Assert.AreEqual(random.InternalState, deserialized.InternalState);
553
+
554
+ if (random is not UnityRandom)
555
+ {
556
+ for (int i = 0; i < NumGeneratorChecks; ++i)
557
+ {
558
+ Assert.AreEqual(random.Next(), deserialized.Next(), "Iteration: " + i);
559
+ Assert.AreEqual(
560
+ random.InternalState,
561
+ deserialized.InternalState,
562
+ "Iteration: " + i
563
+ );
564
+ }
530
565
  }
531
566
  }
532
567
  }
@@ -0,0 +1,12 @@
1
+ namespace WallstopStudios.UnityHelpers.Tests.Random
2
+ {
3
+ using WallstopStudios.UnityHelpers.Core.Random;
4
+
5
+ public sealed class StormDropRandomTests : RandomTestBase
6
+ {
7
+ protected override IRandom NewRandom()
8
+ {
9
+ return new StormDropRandom();
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a1b35b62f8104abf94ed3a48e79d303f
3
+ timeCreated: 1761441026
@@ -23,7 +23,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Serialization
23
23
  public void SingleImplementationRequiresRegistration()
24
24
  {
25
25
  IWidget original = new Widget { Id = 3, Label = "ok" };
26
- byte[] data = Serializer.ProtoSerialize<IWidget>(original);
26
+ byte[] data = Serializer.ProtoSerialize(original);
27
27
 
28
28
  Assert.Throws<ProtoException>(
29
29
  () => Serializer.ProtoDeserialize<IWidget>(data),
@@ -65,7 +65,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Serialization
65
65
  public void AbstractBaseWithoutRegistrationThrows()
66
66
  {
67
67
  AbstractBase original = new DerivedA { Common = 9, ExtraA = "x" };
68
- byte[] data = Serializer.ProtoSerialize<AbstractBase>(original, forceRuntimeType: true);
68
+ byte[] data = Serializer.ProtoSerialize(original, forceRuntimeType: true);
69
69
 
70
70
  Assert.Throws<ProtoException>(
71
71
  () => Serializer.ProtoDeserialize<AbstractBase>(data),
@@ -37,7 +37,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Serialization
37
37
  {
38
38
  IAnimal original = new Dog { Age = 5, Name = "Rex" };
39
39
 
40
- byte[] data = Serializer.ProtoSerialize<IAnimal>(original);
40
+ byte[] data = Serializer.ProtoSerialize(original);
41
41
  Serializer.RegisterProtobufRoot<IAnimal, Dog>();
42
42
 
43
43
  IAnimal round = Serializer.ProtoDeserialize<IAnimal>(data);
@@ -51,7 +51,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Serialization
51
51
  public void ObjectDeclaredUsesRuntimeTypeByDefault()
52
52
  {
53
53
  object original = new DerivedMsg { A = 42, B = "obj" };
54
- byte[] data = Serializer.ProtoSerialize<object>(original);
54
+ byte[] data = Serializer.ProtoSerialize(original);
55
55
  DerivedMsg round = Serializer.ProtoDeserialize<DerivedMsg>(data);
56
56
 
57
57
  Assert.IsNotNull(round, "Deserialized instance should not be null");
@@ -45,13 +45,13 @@ namespace WallstopStudios.UnityHelpers.Tests.Tags
45
45
  maxTicks = 6,
46
46
  modifications = new List<AttributeModification>
47
47
  {
48
- new AttributeModification
48
+ new()
49
49
  {
50
50
  attribute = "health",
51
51
  action = ModificationAction.Addition,
52
52
  value = -7.5f,
53
53
  },
54
- new AttributeModification
54
+ new()
55
55
  {
56
56
  attribute = "armor",
57
57
  action = ModificationAction.Multiplication,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},