com.wallstop-studios.unity-helpers 2.0.0-rc81.9 → 2.0.0
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.
- package/.editorconfig +1 -1
- package/.gitattributes +1 -1
- package/.githooks/pre-commit +31 -5
- package/.githooks/pre-push +50 -0
- package/.github/dependabot.yml +24 -2
- package/.github/scripts/check-markdown-links.ps1 +77 -0
- package/.github/scripts/check_markdown_links.py +89 -0
- package/.github/scripts/check_markdown_url_encoding.py +74 -0
- package/.github/scripts/validate_markdown_links.py +194 -0
- package/.github/workflows/csharpier-autofix.yml +152 -0
- package/.github/workflows/format-on-demand.yml +305 -0
- package/.github/workflows/lint-doc-links.yml +8 -5
- package/.github/workflows/markdown-json.yml +6 -2
- package/.github/workflows/prettier-autofix.yml +195 -0
- package/.github/workflows/update-dotnet-tools.yml +80 -0
- package/.github/workflows/yaml-format-lint.yml +41 -0
- package/.lychee.toml +4 -4
- package/.markdownlint.jsonc +21 -0
- package/.pre-commit-config.yaml +11 -3
- package/.yamllint.yaml +31 -0
- package/AGENTS.md +5 -1
- package/CHANGELOG.md +11 -0
- package/CONTRIBUTING.md +49 -0
- package/CONTRIBUTING.md.meta +7 -0
- package/EDITOR_TOOLS_GUIDE.md +4 -0
- package/Editor/AnimationEventEditor.cs +337 -160
- package/Editor/Core/Helper/AnimationEventHelpers.cs +178 -152
- package/Editor/CustomEditors/PersistentDirectoryGUI.cs +20 -11
- package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +11 -2
- package/Editor/FitTextureSizeWindow.cs +43 -19
- package/Editor/PersistentDirectorySettings.cs +64 -12
- package/Editor/PrefabChecker.cs +72 -5
- package/Editor/Sprites/AnimationCopier.cs +132 -56
- package/Editor/Sprites/AnimationCreator.cs +63 -22
- package/Editor/Sprites/AnimationViewerWindow.cs +42 -6
- package/Editor/Sprites/TexturePlatformNameHelper.cs +50 -39
- package/Editor/Sprites/TextureResizerWizard.cs +23 -1
- package/Editor/Sprites/TextureSettingsApplierWindow.cs +148 -85
- package/Editor/Tools/ImageBlurTool.cs +81 -10
- package/Editor/Utils/EditorUi.cs +1 -1
- package/Editor/Utils/ScriptableObjectSingletonCreator.cs +1 -1
- package/GETTING_STARTED.md +40 -56
- package/RANDOM_PERFORMANCE.md +12 -12
- package/README.md +395 -2407
- package/RELATIONAL_COMPONENTS.md +92 -83
- package/Runtime/AssemblyInfo.cs +2 -0
- package/Runtime/Core/Attributes/NotNullAttribute.cs +1 -3
- package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +50 -5
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +0 -1
- package/Runtime/Core/Extension/RandomExtensions.cs +68 -0
- package/Runtime/Core/Extension/WallstopStudiosLogger.cs +16 -0
- package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +4 -1
- package/Runtime/Core/Helper/ReflectionHelpers.cs +21 -10
- package/Runtime/Core/Helper/SpriteHelpers.cs +3 -1
- package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +45 -1
- package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +13 -5
- package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +1 -1
- package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +1 -1
- package/Runtime/Core/Serialization/Serializer.cs +101 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +96 -0
- package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +90 -10
- package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +13 -1
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs +114 -0
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs.meta +11 -0
- package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +16 -4
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs +241 -0
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +69 -2
- package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +89 -12
- package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +23 -1
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs +44 -0
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +16 -10
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs +243 -0
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Tags/AttributeMetadataCache.cs +1 -4
- package/Runtime/Utils/Buffers.cs +4 -4
- package/Runtime/Utils/ScriptableObjectSingleton.cs +0 -1
- package/Runtime/Utils/SetTextureImportData.cs +3 -1
- package/Runtime/Utils/TextureScale.cs +10 -2
- package/Runtime/Visuals/UGUI/EnhancedImage.cs +6 -0
- package/Runtime/Visuals/UIToolkit/LayeredImage.cs +4 -1
- package/SERIALIZATION.md +15 -0
- package/SPATIAL_TREE_2D_PERFORMANCE.md +85 -82
- package/SPATIAL_TREE_3D_PERFORMANCE.md +94 -91
- package/Samples~/DI - VContainer/README.md +232 -51
- package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +22 -4
- package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +5 -2
- package/Samples~/DI - VContainer/Scripts/Spawner.cs +113 -4
- package/Samples~/DI - Zenject/README.md +217 -53
- package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +3 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs +37 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs.meta +12 -0
- package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +74 -3
- package/Samples~/Random - PRNG/README.md +2 -1
- package/Samples~/Relational Components - Basic/README.md +3 -1
- package/Samples~/Serialization - JSON/README.md +2 -1
- package/Samples~/Spatial Structures - 2D and 3D/README.md +2 -1
- package/Samples~/UGUI - EnhancedImage/README.md +2 -1
- package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +2 -1
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +16 -0
- package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +3 -3
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +6 -2
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs +170 -0
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +2 -1
- package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +3 -2
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs +131 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +6 -2
- package/Tests/Editor/PersistentDirectorySettingsTests.cs +59 -0
- package/Tests/Editor/PersistentDirectorySettingsTests.cs.meta +11 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs +32 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +64 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +1 -1
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +38 -0
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +1 -1
- package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +12 -12
- package/Tests/Editor/Sprites/SpriteCropperTests.cs +9 -9
- package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +3 -3
- package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +18 -0
- package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +5 -5
- package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +3 -3
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +4 -4
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +4 -4
- package/Tests/Editor/Tools/ImageBlurToolTests.cs +22 -110
- package/Tests/Editor/Utils/CommonTestBase.cs +43 -1
- package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +5 -5
- package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +66 -74
- package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +4 -15
- package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +29 -29
- package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +259 -218
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs +86 -0
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs.meta +11 -0
- package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +255 -227
- package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +5 -0
- package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +3 -0
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs +30 -0
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/JsonConverterTests.cs +8 -12
- package/Tests/Runtime/Serialization/JsonSerializationTest.cs +16 -5
- package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +12 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs +105 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs +247 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs.meta +11 -0
- package/Tests/Runtime/TestUtils/CommonTestBase.cs +88 -0
- package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMATests.cs +1 -1
- package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +1 -1
- package/Tests/Runtime/Visuals/EnhancedImageTests.cs +25 -56
- package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +1 -8
- package/package-lock.json.meta +7 -0
- package/package.json +8 -4
- package/scripts/check-eol.ps1 +4 -5
- package/scripts/lint-tests.ps1 +156 -0
- package/scripts/lint-tests.ps1.meta +7 -0
- package/scripts/normalize-eol.ps1 +6 -9
- package/.github/workflows/csharpier.yml +0 -135
package/GETTING_STARTED.md
CHANGED
|
@@ -1,81 +1,65 @@
|
|
|
1
1
|
# Getting Started with Unity Helpers
|
|
2
2
|
|
|
3
|
-
Welcome!
|
|
4
|
-
more reliable, and more enjoyable. This guide will help you get started based on your learning style.
|
|
3
|
+
**Welcome! You're about to save yourself weeks of repetitive work.**
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Unity Helpers is a battle-tested toolkit that eliminates the boring, repetitive code you're tired of writing. This guide gets you productive in 5 minutes, whether you're a beginner or a senior engineer.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## What Makes This Worth Your Time?
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
**Three core principles that save you actual hours:**
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
### 1. 🎯 Zero Boilerplate
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
- Weighted bool with probability? Built-in.
|
|
16
|
-
- Gaussian distribution? Perlin noise maps? Already there.
|
|
13
|
+
**APIs that handle the tedious stuff:**
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
- Random selection with weights? → `random.NextWeightedIndex(weights)`
|
|
16
|
+
- Auto-wire components? → `[SiblingComponent] private Animator animator;`
|
|
17
|
+
- Gaussian distribution? Perlin noise? → Built-in, one method call
|
|
18
|
+
|
|
19
|
+
**Self-documenting code:**
|
|
19
20
|
|
|
20
21
|
```csharp
|
|
21
|
-
[SiblingComponent] private Animator animator;
|
|
22
|
+
[SiblingComponent] private Animator animator; // Clear intent
|
|
22
23
|
[ParentComponent(OnlyAncestors = true)] private Rigidbody2D rb; // Explicit search
|
|
23
|
-
[ChildComponent(MaxDepth = 1)] private Collider2D[] colliders;
|
|
24
|
+
[ChildComponent(MaxDepth = 1)] private Collider2D[] colliders; // Limited scope
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
**
|
|
27
|
-
|
|
28
|
-
- Missing required components? Detailed logs with GameObject names and paths.
|
|
29
|
-
- Invalid spatial tree queries? Clear explanations of what went wrong.
|
|
30
|
-
- Schema evolution issues? Specific guidance on fixing serialization problems.
|
|
31
|
-
|
|
32
|
-
### 2. Performance-Backed
|
|
33
|
-
|
|
34
|
-
**10-15x faster random generation:**
|
|
35
|
-
|
|
36
|
-
- `PRNG.Instance` vs `UnityEngine.Random`: 655M ops/sec vs 65M ops/sec
|
|
37
|
-
- Thread-safe via thread-local instances
|
|
38
|
-
- Fully seedable for deterministic gameplay
|
|
39
|
-
|
|
40
|
-
**Zero-allocation spatial queries:**
|
|
41
|
-
|
|
42
|
-
- Buffering pattern eliminates GC spikes
|
|
43
|
-
- Reusable collections keep frame times stable
|
|
44
|
-
- O(log n) trees scale to millions of objects
|
|
27
|
+
**Helpful errors that save debugging time:**
|
|
45
28
|
|
|
46
|
-
|
|
29
|
+
- Missing components? → Full GameObject path + component type
|
|
30
|
+
- Invalid queries? → Explanation of what went wrong + how to fix it
|
|
31
|
+
- Schema issues? → Specific guidance for your serialization problem
|
|
47
32
|
|
|
48
|
-
|
|
49
|
-
- Field access: ~2ns vs ~200ns (100x speedup)
|
|
50
|
-
- IL2CPP safe and fully tested
|
|
33
|
+
### 2. ⚡ Performance-Proven
|
|
51
34
|
|
|
52
|
-
|
|
35
|
+
**Measurable speed improvements:**
|
|
53
36
|
|
|
54
|
-
**
|
|
37
|
+
- **10-15x faster** random generation (655M ops/sec vs 65M ops/sec)
|
|
38
|
+
- **100x faster** reflection (2ns vs 200ns field access)
|
|
39
|
+
- **O(log n)** spatial queries scale to millions of objects
|
|
40
|
+
- **Zero GC** with buffering pattern
|
|
55
41
|
|
|
56
|
-
-
|
|
57
|
-
- Run before each release to catch regressions
|
|
58
|
-
- Prevent bugs before they reach your players
|
|
42
|
+
**Real-world impact:**
|
|
59
43
|
|
|
60
|
-
|
|
44
|
+
- Stable 60 FPS with 1000+ AI agents querying neighbors
|
|
45
|
+
- No allocation spikes from pooled collections
|
|
46
|
+
- Deterministic replays with seedable RNG
|
|
61
47
|
|
|
62
|
-
|
|
63
|
-
- Performance-critical paths proven at scale
|
|
64
|
-
- API stability from real-world feedback
|
|
48
|
+
### 3. ✅ Production-Ready
|
|
65
49
|
|
|
66
|
-
**
|
|
50
|
+
**Quality you can trust:**
|
|
67
51
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
52
|
+
- ✅ **4,000+ automated tests** - Edge cases covered before you hit them
|
|
53
|
+
- ✅ **Shipped in commercial games** - Battle-tested at scale
|
|
54
|
+
- ✅ **IL2CPP/WebGL compatible** - Works with aggressive compilers
|
|
55
|
+
- ✅ **Schema evolution** - Player saves never break from updates
|
|
56
|
+
- ✅ **SINGLE_THREADED optimized** - 10-20% faster on WebGL
|
|
71
57
|
|
|
72
|
-
**
|
|
58
|
+
**What this means for you:**
|
|
73
59
|
|
|
74
|
-
-
|
|
75
|
-
- No
|
|
76
|
-
-
|
|
77
|
-
- SINGLE_THREADED define for optimized WebGL hot paths
|
|
78
|
-
- 10-20% faster on single-threaded platforms
|
|
60
|
+
- Ship confidently knowing edge cases are handled
|
|
61
|
+
- No "works in editor but not in build" surprises
|
|
62
|
+
- Update your game without corrupting player data
|
|
79
63
|
|
|
80
64
|
---
|
|
81
65
|
|
|
@@ -396,8 +380,8 @@ Pick one feature that solves your immediate problem:
|
|
|
396
380
|
|
|
397
381
|
**Ready to dive deeper?** Return to the [main README](README.md) for the complete feature list.
|
|
398
382
|
|
|
399
|
-
**Building something cool?** We'd love to hear about it! Share your experience
|
|
400
|
-
[
|
|
383
|
+
**Building something cool?** We'd love to hear about it! Share your experience by opening an
|
|
384
|
+
[issue](https://github.com/wallstop/unity-helpers/issues).
|
|
401
385
|
|
|
402
386
|
---
|
|
403
387
|
|
package/RANDOM_PERFORMANCE.md
CHANGED
|
@@ -81,18 +81,18 @@ This document contains performance benchmarks for the various random number gene
|
|
|
81
81
|
|
|
82
82
|
| Random | NextBool | Next | NextUInt | NextFloat | NextDouble | NextUint - Range | NextInt - Range |
|
|
83
83
|
| --------------------------- | ----------- | ----------- | ------------- | ----------- | ----------- | ---------------- | --------------- |
|
|
84
|
-
| DotNetRandom |
|
|
85
|
-
| LinearCongruentialGenerator |
|
|
86
|
-
| IllusionFlow |
|
|
87
|
-
| PcgRandom |
|
|
88
|
-
| RomuDuo |
|
|
89
|
-
| SplitMix64 |
|
|
90
|
-
| SquirrelRandom |
|
|
91
|
-
| SystemRandom |
|
|
92
|
-
| UnityRandom | 657,
|
|
93
|
-
| WyRandom |
|
|
94
|
-
| XorShiftRandom |
|
|
95
|
-
| XoroShiroRandom |
|
|
84
|
+
| DotNetRandom | 534,500,000 | 55,300,000 | 57,600,000 | 46,500,000 | 27,400,000 | 53,700,000 | 53,500,000 |
|
|
85
|
+
| LinearCongruentialGenerator | 801,300,000 | 876,500,000 | 1,307,000,000 | 188,400,000 | 376,000,000 | 584,200,000 | 501,200,000 |
|
|
86
|
+
| IllusionFlow | 778,600,000 | 631,500,000 | 880,200,000 | 183,400,000 | 324,000,000 | 438,700,000 | 389,100,000 |
|
|
87
|
+
| PcgRandom | 785,600,000 | 653,100,000 | 909,700,000 | 188,800,000 | 312,600,000 | 450,700,000 | 406,500,000 |
|
|
88
|
+
| RomuDuo | 778,000,000 | 588,000,000 | 754,900,000 | 170,200,000 | 251,600,000 | 439,200,000 | 391,900,000 |
|
|
89
|
+
| SplitMix64 | 780,500,000 | 750,100,000 | 1,058,400,000 | 191,300,000 | 358,800,000 | 485,500,000 | 441,300,000 |
|
|
90
|
+
| SquirrelRandom | 758,000,000 | 408,100,000 | 413,800,000 | 178,200,000 | 188,100,000 | 367,900,000 | 339,500,000 |
|
|
91
|
+
| SystemRandom | 148,000,000 | 148,900,000 | 64,500,000 | 132,000,000 | 139,200,000 | 59,000,000 | 59,000,000 |
|
|
92
|
+
| UnityRandom | 657,400,000 | 85,100,000 | 87,800,000 | 63,000,000 | 41,500,000 | 81,100,000 | 82,100,000 |
|
|
93
|
+
| WyRandom | 759,500,000 | 383,800,000 | 454,200,000 | 171,600,000 | 189,000,000 | 295,600,000 | 280,100,000 |
|
|
94
|
+
| XorShiftRandom | 788,000,000 | 592,100,000 | 603,600,000 | 190,900,000 | 262,100,000 | 479,000,000 | 420,900,000 |
|
|
95
|
+
| XoroShiroRandom | 780,600,000 | 557,000,000 | 754,300,000 | 172,800,000 | 251,700,000 | 421,300,000 | 376,300,000 |
|
|
96
96
|
|
|
97
97
|
<!-- RANDOM_BENCHMARKS_END -->
|
|
98
98
|
|