com.wallstop-studios.unity-helpers 2.0.0-rc81.9 → 2.0.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 (264) hide show
  1. package/.editorconfig +1 -1
  2. package/.gitattributes +1 -1
  3. package/.githooks/pre-commit +31 -5
  4. package/.githooks/pre-push +50 -0
  5. package/.github/dependabot.yml +24 -2
  6. package/.github/scripts/check-markdown-links.ps1 +77 -0
  7. package/.github/scripts/check_markdown_links.py +89 -0
  8. package/.github/scripts/check_markdown_url_encoding.py +74 -0
  9. package/.github/scripts/validate_markdown_links.py +194 -0
  10. package/.github/workflows/csharpier-autofix.yml +152 -0
  11. package/.github/workflows/format-on-demand.yml +305 -0
  12. package/.github/workflows/lint-doc-links.yml +8 -5
  13. package/.github/workflows/markdown-json.yml +6 -2
  14. package/.github/workflows/npm-publish.yml +1 -1
  15. package/.github/workflows/prettier-autofix.yml +195 -0
  16. package/.github/workflows/update-dotnet-tools.yml +80 -0
  17. package/.github/workflows/yaml-format-lint.yml +41 -0
  18. package/.lychee.toml +4 -4
  19. package/.markdownlint.jsonc +21 -0
  20. package/.pre-commit-config.yaml +11 -3
  21. package/.yamllint.yaml +31 -0
  22. package/AGENTS.md +5 -1
  23. package/Docs/CHANGELOG.md +11 -0
  24. package/Docs/CONTRIBUTING.md +49 -0
  25. package/Docs/CONTRIBUTING.md.meta +7 -0
  26. package/{EDITOR_TOOLS_GUIDE.md → Docs/EDITOR_TOOLS_GUIDE.md} +4 -0
  27. package/Docs/EFFECTS_SYSTEM.md +1316 -0
  28. package/{EFFECTS_SYSTEM_TUTORIAL.md → Docs/EFFECTS_SYSTEM_TUTORIAL.md} +1 -1
  29. package/{GETTING_STARTED.md → Docs/GETTING_STARTED.md} +50 -64
  30. package/{GLOSSARY.md → Docs/GLOSSARY.md} +4 -4
  31. package/Docs/HELPER_UTILITIES.md +885 -0
  32. package/Docs/HELPER_UTILITIES.md.meta +7 -0
  33. package/{INDEX.md → Docs/INDEX.md} +107 -62
  34. package/Docs/MATH_AND_EXTENSIONS.md +1039 -0
  35. package/{RANDOM_PERFORMANCE.md → Docs/RANDOM_PERFORMANCE.md} +15 -15
  36. package/{RELATIONAL_COMPONENTS.md → Docs/RELATIONAL_COMPONENTS.md} +111 -84
  37. package/{SERIALIZATION.md → Docs/SERIALIZATION.md} +15 -0
  38. package/{SPATIAL_TREES_2D_GUIDE.md → Docs/SPATIAL_TREES_2D_GUIDE.md} +2 -2
  39. package/{SPATIAL_TREES_3D_GUIDE.md → Docs/SPATIAL_TREES_3D_GUIDE.md} +1 -1
  40. package/Docs/SPATIAL_TREE_2D_PERFORMANCE.md +241 -0
  41. package/Docs/SPATIAL_TREE_3D_PERFORMANCE.md +243 -0
  42. package/{THIRD_PARTY_NOTICES.md → Docs/THIRD_PARTY_NOTICES.md} +1 -1
  43. package/Docs/UTILITY_COMPONENTS.md +906 -0
  44. package/Docs/UTILITY_COMPONENTS.md.meta +7 -0
  45. package/Docs/VISUAL_COMPONENTS.md +337 -0
  46. package/Docs/VISUAL_COMPONENTS.md.meta +7 -0
  47. package/Editor/AnimationEventEditor.cs +337 -160
  48. package/Editor/Core/Helper/AnimationEventHelpers.cs +178 -152
  49. package/Editor/CustomEditors/PersistentDirectoryGUI.cs +20 -11
  50. package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +11 -2
  51. package/Editor/FitTextureSizeWindow.cs +43 -19
  52. package/Editor/PersistentDirectorySettings.cs +64 -12
  53. package/Editor/PrefabChecker.cs +72 -5
  54. package/Editor/Sprites/AnimationCopier.cs +131 -55
  55. package/Editor/Sprites/AnimationCreator.cs +63 -22
  56. package/Editor/Sprites/AnimationViewerWindow.cs +42 -6
  57. package/Editor/Sprites/TexturePlatformNameHelper.cs +50 -39
  58. package/Editor/Sprites/TextureResizerWizard.cs +23 -1
  59. package/Editor/Sprites/TextureSettingsApplierWindow.cs +148 -85
  60. package/Editor/Tools/ImageBlurTool.cs +81 -10
  61. package/Editor/Utils/EditorUi.cs +1 -1
  62. package/Editor/Utils/ScriptableObjectSingletonCreator.cs +1 -1
  63. package/README.md +428 -2433
  64. package/Runtime/AssemblyInfo.cs +4 -0
  65. package/Runtime/Core/Attributes/NotNullAttribute.cs +1 -3
  66. package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +50 -5
  67. package/Runtime/Core/DataStructure/CyclicBuffer.cs +0 -1
  68. package/Runtime/Core/DataStructure/KDTree3D.cs +1 -1
  69. package/Runtime/Core/DataStructure/OctTree3D.cs +1 -1
  70. package/Runtime/Core/Extension/AsyncOperationExtensions.cs +122 -0
  71. package/Runtime/Core/Extension/RandomExtensions.cs +68 -0
  72. package/Runtime/Core/Extension/WallstopStudiosLogger.cs +16 -0
  73. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +4 -1
  74. package/Runtime/Core/Helper/ReflectionHelpers.cs +21 -10
  75. package/Runtime/Core/Helper/SpriteHelpers.cs +3 -1
  76. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +45 -1
  77. package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +13 -5
  78. package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +1 -1
  79. package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +1 -1
  80. package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs +24 -29
  81. package/Runtime/Core/Serialization/Serializer.cs +101 -0
  82. package/Runtime/Integrations/Reflex/AssemblyInfo.cs +7 -0
  83. package/Runtime/Integrations/Reflex/AssemblyInfo.cs.meta +11 -0
  84. package/Runtime/Integrations/Reflex/ContainerRelationalExtensions.cs +198 -0
  85. package/Runtime/Integrations/Reflex/ContainerRelationalExtensions.cs.meta +11 -0
  86. package/Runtime/Integrations/Reflex/RelationalComponentsInstaller.cs +86 -0
  87. package/Runtime/Integrations/Reflex/RelationalComponentsInstaller.cs.meta +11 -0
  88. package/Runtime/Integrations/Reflex/RelationalReflexSceneBootstrapper.cs +316 -0
  89. package/Runtime/Integrations/Reflex/RelationalReflexSceneBootstrapper.cs.meta +11 -0
  90. package/Runtime/Integrations/Reflex/RelationalSceneAssignmentOptions.cs +86 -0
  91. package/Runtime/Integrations/Reflex/RelationalSceneAssignmentOptions.cs.meta +11 -0
  92. package/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Integration.Reflex.asmdef +20 -0
  93. package/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Integration.Reflex.asmdef.meta +7 -0
  94. package/Runtime/Integrations/Reflex.meta +8 -0
  95. package/Runtime/Integrations/VContainer/AssemblyInfo.cs +9 -0
  96. package/Runtime/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
  97. package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +96 -0
  98. package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +90 -10
  99. package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +13 -1
  100. package/Runtime/Integrations/VContainer/RelationalObjectPools.cs +114 -0
  101. package/Runtime/Integrations/VContainer/RelationalObjectPools.cs.meta +11 -0
  102. package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +16 -4
  103. package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs +241 -0
  104. package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs.meta +11 -0
  105. package/Runtime/Integrations/Zenject/AssemblyInfo.cs +9 -0
  106. package/Runtime/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
  107. package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +69 -2
  108. package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +89 -12
  109. package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +23 -1
  110. package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs +44 -0
  111. package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs.meta +11 -0
  112. package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +16 -10
  113. package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs +243 -0
  114. package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs.meta +11 -0
  115. package/Runtime/Tags/AttributeMetadataCache.cs +1 -4
  116. package/Runtime/Utils/Buffers.cs +4 -4
  117. package/Runtime/Utils/ScriptableObjectSingleton.cs +1 -2
  118. package/Runtime/Utils/SetTextureImportData.cs +3 -1
  119. package/Runtime/Utils/TextureScale.cs +10 -2
  120. package/Runtime/Visuals/UGUI/EnhancedImage.cs +6 -0
  121. package/Runtime/Visuals/UIToolkit/LayeredImage.cs +4 -1
  122. package/Samples~/DI - Reflex/README.md +527 -0
  123. package/Samples~/DI - Reflex/README.md.meta +7 -0
  124. package/Samples~/DI - Reflex/Scripts/ReflexPaletteService.cs +36 -0
  125. package/Samples~/DI - Reflex/Scripts/ReflexPaletteService.cs.meta +11 -0
  126. package/Samples~/DI - Reflex/Scripts/ReflexRelationalConsumer.cs +79 -0
  127. package/Samples~/DI - Reflex/Scripts/ReflexRelationalConsumer.cs.meta +11 -0
  128. package/Samples~/DI - Reflex/Scripts/ReflexSampleInstaller.cs +30 -0
  129. package/Samples~/DI - Reflex/Scripts/ReflexSampleInstaller.cs.meta +11 -0
  130. package/Samples~/DI - Reflex/Scripts/ReflexSpawner.cs +79 -0
  131. package/Samples~/DI - Reflex/Scripts/ReflexSpawner.cs.meta +11 -0
  132. package/Samples~/DI - Reflex/Scripts/Samples.UnityHelpers.DI.Reflex.asmdef +26 -0
  133. package/Samples~/DI - Reflex/Scripts/Samples.UnityHelpers.DI.Reflex.asmdef.meta +9 -0
  134. package/Samples~/DI - Reflex/Scripts.meta +8 -0
  135. package/Samples~/DI - Reflex.meta +8 -0
  136. package/Samples~/DI - VContainer/README.md +238 -56
  137. package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +22 -4
  138. package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +5 -2
  139. package/Samples~/DI - VContainer/Scripts/Spawner.cs +113 -4
  140. package/Samples~/DI - Zenject/README.md +223 -58
  141. package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +3 -0
  142. package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs +37 -0
  143. package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs.meta +12 -0
  144. package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +74 -3
  145. package/Samples~/Random - PRNG/README.md +2 -1
  146. package/Samples~/Relational Components - Basic/README.md +3 -1
  147. package/Samples~/Serialization - JSON/README.md +2 -1
  148. package/Samples~/Spatial Structures - 2D and 3D/README.md +2 -1
  149. package/Samples~/UGUI - EnhancedImage/README.md +2 -1
  150. package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +2 -1
  151. package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +16 -0
  152. package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +32 -34
  153. package/Tests/Editor/Integrations/Reflex/ReflexIntegrationCompilationTests.cs +41 -0
  154. package/Tests/Editor/Integrations/Reflex/ReflexIntegrationCompilationTests.cs.meta +11 -0
  155. package/Tests/Editor/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Editor.Reflex.asmdef +27 -0
  156. package/Tests/Editor/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Editor.Reflex.asmdef.meta +7 -0
  157. package/Tests/Editor/Integrations/Reflex.meta +8 -0
  158. package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +21 -18
  159. package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs +164 -0
  160. package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs.meta +11 -0
  161. package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +2 -1
  162. package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +3 -2
  163. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs +127 -0
  164. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs.meta +11 -0
  165. package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +25 -23
  166. package/Tests/Editor/PersistentDirectorySettingsTests.cs +58 -0
  167. package/Tests/Editor/PersistentDirectorySettingsTests.cs.meta +11 -0
  168. package/Tests/Editor/PrefabCheckerReportTests.cs +32 -0
  169. package/Tests/Editor/PrefabCheckerReportTests.cs.meta +11 -0
  170. package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +63 -0
  171. package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs.meta +11 -0
  172. package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +1 -1
  173. package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +38 -0
  174. package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs.meta +11 -0
  175. package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +1 -1
  176. package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +12 -12
  177. package/Tests/Editor/Sprites/SpriteCropperTests.cs +9 -9
  178. package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +3 -3
  179. package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +18 -0
  180. package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +5 -5
  181. package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +3 -3
  182. package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +4 -4
  183. package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +4 -4
  184. package/Tests/Editor/Tools/ImageBlurToolTests.cs +22 -110
  185. package/Tests/Editor/Utils/CommonTestBase.cs +60 -1
  186. package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +6 -6
  187. package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +66 -74
  188. package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +4 -15
  189. package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +29 -29
  190. package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs +179 -0
  191. package/Tests/Runtime/Extensions/RandomExtensionTests.cs +55 -0
  192. package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs +445 -0
  193. package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs.meta +11 -0
  194. package/Tests/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Runtime.Reflex.asmdef +28 -0
  195. package/Tests/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Runtime.Reflex.asmdef.meta +7 -0
  196. package/Tests/Runtime/Integrations/Reflex.meta +8 -0
  197. package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +257 -221
  198. package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs +91 -0
  199. package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs.meta +11 -0
  200. package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +251 -233
  201. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +1 -1
  202. package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +6 -1
  203. package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +4 -1
  204. package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs +30 -0
  205. package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs.meta +11 -0
  206. package/Tests/Runtime/Serialization/JsonConverterTests.cs +8 -12
  207. package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs +4 -9
  208. package/Tests/Runtime/Serialization/JsonSerializationTest.cs +16 -5
  209. package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs +13 -13
  210. package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +12 -0
  211. package/Tests/Runtime/Serialization/SerializerFileIoTests.cs +105 -0
  212. package/Tests/Runtime/Serialization/SerializerFileIoTests.cs.meta +11 -0
  213. package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs +247 -0
  214. package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs.meta +11 -0
  215. package/Tests/Runtime/TestUtils/CommonTestBase.cs +99 -0
  216. package/Tests/Runtime/TestUtils/ReflexTestSupport.cs +111 -0
  217. package/Tests/Runtime/TestUtils/ReflexTestSupport.cs.meta +12 -0
  218. package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +1 -1
  219. package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +1 -1
  220. package/Tests/Runtime/Utils/LZMATests.cs +1 -1
  221. package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +5 -5
  222. package/Tests/Runtime/Visuals/EnhancedImageTests.cs +25 -56
  223. package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +1 -8
  224. package/Tests/TestUtils.meta +8 -0
  225. package/package-lock.json.meta +7 -0
  226. package/package.json +13 -4
  227. package/scripts/check-eol.ps1 +4 -5
  228. package/scripts/lint-tests.ps1 +156 -0
  229. package/scripts/lint-tests.ps1.meta +7 -0
  230. package/scripts/normalize-eol.ps1 +6 -9
  231. package/.github/workflows/csharpier.yml +0 -135
  232. package/CHANGELOG.md +0 -0
  233. package/EFFECTS_SYSTEM.md +0 -242
  234. package/MATH_AND_EXTENSIONS.md +0 -316
  235. package/SPATIAL_TREE_2D_PERFORMANCE.md +0 -238
  236. package/SPATIAL_TREE_3D_PERFORMANCE.md +0 -240
  237. /package/{CHANGELOG.md.meta → Docs/CHANGELOG.md.meta} +0 -0
  238. /package/{DATA_STRUCTURES.md → Docs/DATA_STRUCTURES.md} +0 -0
  239. /package/{DATA_STRUCTURES.md.meta → Docs/DATA_STRUCTURES.md.meta} +0 -0
  240. /package/{EDITOR_TOOLS_GUIDE.md.meta → Docs/EDITOR_TOOLS_GUIDE.md.meta} +0 -0
  241. /package/{EFFECTS_SYSTEM.md.meta → Docs/EFFECTS_SYSTEM.md.meta} +0 -0
  242. /package/{EFFECTS_SYSTEM_TUTORIAL.md.meta → Docs/EFFECTS_SYSTEM_TUTORIAL.md.meta} +0 -0
  243. /package/{GETTING_STARTED.md.meta → Docs/GETTING_STARTED.md.meta} +0 -0
  244. /package/{GLOSSARY.md.meta → Docs/GLOSSARY.md.meta} +0 -0
  245. /package/{HULLS.md → Docs/HULLS.md} +0 -0
  246. /package/{HULLS.md.meta → Docs/HULLS.md.meta} +0 -0
  247. /package/{INDEX.md.meta → Docs/INDEX.md.meta} +0 -0
  248. /package/{LICENSE.md → Docs/LICENSE.md} +0 -0
  249. /package/{LICENSE.md.meta → Docs/LICENSE.md.meta} +0 -0
  250. /package/{MATH_AND_EXTENSIONS.md.meta → Docs/MATH_AND_EXTENSIONS.md.meta} +0 -0
  251. /package/{RANDOM_PERFORMANCE.md.meta → Docs/RANDOM_PERFORMANCE.md.meta} +0 -0
  252. /package/{REFLECTION_HELPERS.md → Docs/REFLECTION_HELPERS.md} +0 -0
  253. /package/{REFLECTION_HELPERS.md.meta → Docs/REFLECTION_HELPERS.md.meta} +0 -0
  254. /package/{RELATIONAL_COMPONENTS.md.meta → Docs/RELATIONAL_COMPONENTS.md.meta} +0 -0
  255. /package/{SERIALIZATION.md.meta → Docs/SERIALIZATION.md.meta} +0 -0
  256. /package/{SINGLETONS.md → Docs/SINGLETONS.md} +0 -0
  257. /package/{SINGLETONS.md.meta → Docs/SINGLETONS.md.meta} +0 -0
  258. /package/{SPATIAL_TREES_2D_GUIDE.md.meta → Docs/SPATIAL_TREES_2D_GUIDE.md.meta} +0 -0
  259. /package/{SPATIAL_TREES_3D_GUIDE.md.meta → Docs/SPATIAL_TREES_3D_GUIDE.md.meta} +0 -0
  260. /package/{SPATIAL_TREE_2D_PERFORMANCE.md.meta → Docs/SPATIAL_TREE_2D_PERFORMANCE.md.meta} +0 -0
  261. /package/{SPATIAL_TREE_3D_PERFORMANCE.md.meta → Docs/SPATIAL_TREE_3D_PERFORMANCE.md.meta} +0 -0
  262. /package/{SPATIAL_TREE_SEMANTICS.md → Docs/SPATIAL_TREE_SEMANTICS.md} +0 -0
  263. /package/{SPATIAL_TREE_SEMANTICS.md.meta → Docs/SPATIAL_TREE_SEMANTICS.md.meta} +0 -0
  264. /package/{THIRD_PARTY_NOTICES.md.meta → Docs/THIRD_PARTY_NOTICES.md.meta} +0 -0
@@ -7,14 +7,85 @@ namespace Samples.UnityHelpers.DI.Zenject
7
7
  public sealed class SpawnerZenject : MonoBehaviour
8
8
  {
9
9
  [SerializeField]
10
- private RelationalConsumer _prefab;
10
+ private RelationalConsumer _componentPrefab;
11
+
12
+ [SerializeField]
13
+ private GameObject _hierarchyPrefab;
14
+
15
+ [SerializeField]
16
+ private Transform _defaultParent;
11
17
 
12
18
  [Inject]
13
19
  private DiContainer _container;
14
20
 
15
- public RelationalConsumer Build(Transform parent)
21
+ [Inject(Optional = true)]
22
+ private RelationalConsumerPool _pool;
23
+
24
+ /// <summary>
25
+ /// Instantiate a component prefab through Zenject so dependencies and relational fields are populated automatically.
26
+ /// </summary>
27
+ public RelationalConsumer SpawnComponent(Transform parent)
28
+ {
29
+ Transform targetParent = parent != null ? parent : _defaultParent;
30
+ return _container.InstantiateComponentWithRelations(_componentPrefab, targetParent);
31
+ }
32
+
33
+ /// <summary>
34
+ /// Instantiate a hierarchy prefab and hydrate every attributed component beneath it.
35
+ /// </summary>
36
+ public GameObject SpawnHierarchy(Transform parent)
37
+ {
38
+ Transform targetParent = parent != null ? parent : _defaultParent;
39
+ return _container.InstantiateGameObjectWithRelations(
40
+ _hierarchyPrefab,
41
+ targetParent,
42
+ includeInactiveChildren: true
43
+ );
44
+ }
45
+
46
+ /// <summary>
47
+ /// Rent an instance from a Zenject memory pool (falls back to SpawnComponent when the pool is not bound).
48
+ /// </summary>
49
+ public RelationalConsumer SpawnFromPool(Transform parent)
50
+ {
51
+ if (_pool == null)
52
+ {
53
+ return SpawnComponent(parent);
54
+ }
55
+
56
+ RelationalConsumer instance = _pool.Spawn();
57
+ Transform targetParent = parent != null ? parent : _defaultParent;
58
+ if (targetParent != null)
59
+ {
60
+ instance.transform.SetParent(targetParent, false);
61
+ }
62
+ return instance;
63
+ }
64
+
65
+ /// <summary>
66
+ /// Return an instance to the pool.
67
+ /// </summary>
68
+ public void DespawnToPool(RelationalConsumer instance)
16
69
  {
17
- return _container.InstantiateComponentWithRelations(_prefab, parent);
70
+ if (_pool == null || instance == null)
71
+ {
72
+ return;
73
+ }
74
+
75
+ _pool.Despawn(instance);
76
+ }
77
+
78
+ /// <summary>
79
+ /// Hydrate an existing hierarchy that was created outside of the container (editor tooling etc.).
80
+ /// </summary>
81
+ public void HydrateExistingHierarchy(GameObject root)
82
+ {
83
+ if (root == null)
84
+ {
85
+ return;
86
+ }
87
+
88
+ _container.AssignRelationalHierarchy(root, includeInactiveChildren: true);
18
89
  }
19
90
  }
20
91
  }
@@ -3,10 +3,11 @@ Random – PRNG Utilities
3
3
  Shows quick usage of the high-quality PRNGs (e.g., PCG) for integers, floats, Gaussian values, and sampling from collections.
4
4
 
5
5
  How to use
6
+
6
7
  - Add `RandomPrngDemo` to any GameObject and press Play.
7
8
  - Optionally change the `seed` in the inspector for deterministic sequences.
8
9
 
9
10
  What it shows
11
+
10
12
  - `PcgRandom` construction with a seed and sampling `Next`, `NextFloat`, `NextGaussian`.
11
13
  - `NextOf` to pick elements from lists.
12
-
@@ -3,17 +3,19 @@ Relational Components – Basic
3
3
  This sample demonstrates the built-in Relational Component Attributes without any DI container. Attach the script to a GameObject hierarchy and the fields are auto-assigned at runtime.
4
4
 
5
5
  How to use
6
+
6
7
  - Open any scene and create a simple hierarchy with a parent, a child, and a sibling next to the consumer object.
7
8
  - Add `RelationalBasicConsumer` to the child object.
8
9
  - Enter Play Mode and check the Console for the assigned references.
9
10
 
10
11
  What it shows
12
+
11
13
  - `[ParentComponent]` finds components on ancestors (configurable depth).
12
14
  - `[SiblingComponent]` finds components on the same GameObject.
13
15
  - `[ChildComponent]` finds components on children (recursively).
14
16
  - `this.AssignRelationalComponents()` hydrates all relational fields in `Awake()`/`OnEnable()`.
15
17
 
16
18
  Notes
19
+
17
20
  - You can adjust filters on attributes: `Optional`, `IncludeInactive`, `TagFilter`, `NameFilter`, and `MaxCount` for collections.
18
21
  - For DI integrations, see the separate VContainer/Zenject samples.
19
-
@@ -3,11 +3,12 @@ Serialization – JSON Converters
3
3
  Demonstrates serialization of Unity types using System.Text.Json with Unity Helpers’ built-in converters and helper APIs.
4
4
 
5
5
  How to use
6
+
6
7
  - Add `JsonSerializationDemo` to any GameObject and press Play.
7
8
  - Check the Console for serialized JSON, byte sizes, and a round-trip decode.
8
9
 
9
10
  What it shows
11
+
10
12
  - `Serializer.JsonStringify` and `Serializer.JsonDeserialize<T>` for text workflows.
11
13
  - `Serializer.JsonSerialize` and `Serializer.JsonDeserialize<T>(byte[])` for UTF-8 bytes.
12
14
  - Using `Serializer.CreateFastJsonOptions()` for hot paths.
13
-
@@ -3,11 +3,12 @@ Spatial Structures – 2D and 3D
3
3
  Demonstrates building and querying spatial structures for static point sets and grid-based indexing.
4
4
 
5
5
  How to use
6
+
6
7
  - Add `SpatialStructuresDemo` to any GameObject and press Play.
7
8
  - Adjust `pointCount`, `areaSize`, and `queryRadius` in the inspector.
8
9
 
9
10
  What it shows
11
+
10
12
  - `QuadTree2D<T>` created from points with a transformer and radius query.
11
13
  - `KdTree2D<T>` approximate nearest neighbors.
12
14
  - `SpatialHash2D<T>` bucketed insertion and radius query.
13
-
@@ -3,10 +3,11 @@ UGUI – EnhancedImage
3
3
  Shows programmatic setup and basic usage of `EnhancedImage` with HDR tinting.
4
4
 
5
5
  How to use
6
+
6
7
  - Add `EnhancedImageDemo` to an empty scene and press Play.
7
8
  - Optionally assign a `materialTemplate` in the inspector to use a shader that exposes `_Color` and optional `_ShapeMask`.
8
9
 
9
10
  What it shows
11
+
10
12
  - Creating a `Canvas` and an `EnhancedImage` at runtime.
11
13
  - Setting an HDR tint via `HdrColor` (values > 1).
12
-
@@ -3,10 +3,11 @@ UI Toolkit – MultiFile Selector (Editor)
3
3
  A minimal EditorWindow showcasing `MultiFileSelectorElement` for fast in-Editor multi-file selection with breadcrumbs, filtering and virtualization.
4
4
 
5
5
  How to use
6
+
6
7
  - Import the sample, then open: `Window > Unity Helpers > MultiFile Selector Sample`.
7
8
  - Pick extensions and select multiple files; results are logged to the Console.
8
9
 
9
10
  What it shows
11
+
10
12
  - Creating and adding `MultiFileSelectorElement` to an EditorWindow.
11
13
  - Hooks for `OnFilesSelected` and `OnCancelled`.
12
-
@@ -93,6 +93,22 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Attributes
93
93
 
94
94
  CollectionAssert.AreEquivalent(expected, methods.Select(method => method.Name));
95
95
  }
96
+
97
+ [Test]
98
+ public void GetPossibleAnimatorEventsAreSortedByName()
99
+ {
100
+ List<MethodInfo> methods = AnimationEventHelpers.GetPossibleAnimatorEventsForType(
101
+ typeof(AnimationEventSignatureHost)
102
+ );
103
+ // Ensure ascending ordinal sort by method name
104
+ for (int i = 1; i < methods.Count; i++)
105
+ {
106
+ Assert.LessOrEqual(
107
+ string.Compare(methods[i - 1].Name, methods[i].Name, StringComparison.Ordinal),
108
+ 0
109
+ );
110
+ }
111
+ }
96
112
  }
97
113
 
98
114
  internal enum AnimationEventSignal
@@ -28,20 +28,19 @@ namespace WallstopStudios.UnityHelpers.Tests.Core.Attributes
28
28
  {
29
29
  AttributeMetadataCache cache = CreateScriptableObject<AttributeMetadataCache>();
30
30
 
31
- AttributeMetadataCache.RelationalTypeMetadata relationalMetadata =
32
- new AttributeMetadataCache.RelationalTypeMetadata(
33
- typeof(RelationalConsumer).AssemblyQualifiedName,
34
- new[]
35
- {
36
- new AttributeMetadataCache.RelationalFieldMetadata(
37
- "_spriteRenderer",
38
- AttributeMetadataCache.RelationalAttributeKind.Sibling,
39
- AttributeMetadataCache.FieldKind.Single,
40
- typeof(SpriteRenderer).AssemblyQualifiedName,
41
- false
42
- ),
43
- }
44
- );
31
+ AttributeMetadataCache.RelationalTypeMetadata relationalMetadata = new(
32
+ typeof(RelationalConsumer).AssemblyQualifiedName,
33
+ new[]
34
+ {
35
+ new AttributeMetadataCache.RelationalFieldMetadata(
36
+ "_spriteRenderer",
37
+ AttributeMetadataCache.RelationalAttributeKind.Sibling,
38
+ AttributeMetadataCache.FieldKind.Single,
39
+ typeof(SpriteRenderer).AssemblyQualifiedName,
40
+ false
41
+ ),
42
+ }
43
+ );
45
44
 
46
45
  cache.SetMetadata(
47
46
  System.Array.Empty<string>(),
@@ -50,7 +49,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Core.Attributes
50
49
  );
51
50
  cache.ForceRebuildForTests();
52
51
 
53
- RelationalComponentAssigner assigner = new RelationalComponentAssigner(cache);
52
+ RelationalComponentAssigner assigner = new(cache);
54
53
 
55
54
  Assert.IsTrue(
56
55
  assigner.HasRelationalAssignments(typeof(RelationalConsumer)),
@@ -67,20 +66,19 @@ namespace WallstopStudios.UnityHelpers.Tests.Core.Attributes
67
66
  {
68
67
  AttributeMetadataCache cache = CreateScriptableObject<AttributeMetadataCache>();
69
68
 
70
- AttributeMetadataCache.RelationalTypeMetadata relationalMetadata =
71
- new AttributeMetadataCache.RelationalTypeMetadata(
72
- typeof(RelationalConsumer).AssemblyQualifiedName,
73
- new[]
74
- {
75
- new AttributeMetadataCache.RelationalFieldMetadata(
76
- "_spriteRenderer",
77
- AttributeMetadataCache.RelationalAttributeKind.Sibling,
78
- AttributeMetadataCache.FieldKind.Single,
79
- typeof(SpriteRenderer).AssemblyQualifiedName,
80
- false
81
- ),
82
- }
83
- );
69
+ AttributeMetadataCache.RelationalTypeMetadata relationalMetadata = new(
70
+ typeof(RelationalConsumer).AssemblyQualifiedName,
71
+ new[]
72
+ {
73
+ new AttributeMetadataCache.RelationalFieldMetadata(
74
+ "_spriteRenderer",
75
+ AttributeMetadataCache.RelationalAttributeKind.Sibling,
76
+ AttributeMetadataCache.FieldKind.Single,
77
+ typeof(SpriteRenderer).AssemblyQualifiedName,
78
+ false
79
+ ),
80
+ }
81
+ );
84
82
 
85
83
  cache.SetMetadata(
86
84
  System.Array.Empty<string>(),
@@ -89,7 +87,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Core.Attributes
89
87
  );
90
88
  cache.ForceRebuildForTests();
91
89
 
92
- RelationalComponentAssigner assigner = new RelationalComponentAssigner(cache);
90
+ RelationalComponentAssigner assigner = new(cache);
93
91
 
94
92
  GameObject go1 = NewGameObject("Relational");
95
93
  SpriteRenderer sr1 = go1.AddComponent<SpriteRenderer>();
@@ -98,13 +96,13 @@ namespace WallstopStudios.UnityHelpers.Tests.Core.Attributes
98
96
  GameObject go2 = NewGameObject("NonRelational");
99
97
  NonRelational non = go2.AddComponent<NonRelational>();
100
98
 
101
- Assert.IsNull(consumer.SR, "Precondition: relational field should start null");
99
+ Assert.IsTrue(consumer.SR == null, "Precondition: relational field should start null");
102
100
 
103
- List<Component> items = new List<Component> { consumer, null, non.transform };
101
+ List<Component> items = new() { consumer, null, non.transform };
104
102
  assigner.Assign(items);
105
103
 
106
- Assert.IsNotNull(
107
- consumer.SR,
104
+ Assert.IsTrue(
105
+ consumer.SR != null,
108
106
  "Relational field should be assigned by Assign(IEnumerable<Component>)"
109
107
  );
110
108
 
@@ -0,0 +1,41 @@
1
+ #if REFLEX_PRESENT
2
+ namespace WallstopStudios.UnityHelpers.Tests.Integrations.Reflex
3
+ {
4
+ using System.Reflection;
5
+ using NUnit.Framework;
6
+ using WallstopStudios.UnityHelpers.Integrations.Reflex;
7
+
8
+ public sealed class ReflexIntegrationCompilationTests
9
+ {
10
+ [Test]
11
+ public void CanReferenceReflexIntegrationTypes()
12
+ {
13
+ Assert.NotNull(
14
+ typeof(RelationalComponentsInstaller),
15
+ "RelationalComponentsInstaller should be available when REFLEX_PRESENT is defined."
16
+ );
17
+ Assert.NotNull(
18
+ typeof(ContainerRelationalExtensions),
19
+ "ContainerRelationalExtensions should be available when REFLEX_PRESENT is defined."
20
+ );
21
+ Assert.NotNull(
22
+ typeof(RelationalSceneAssignmentOptions),
23
+ "RelationalSceneAssignmentOptions should be available when REFLEX_PRESENT is defined."
24
+ );
25
+ }
26
+
27
+ [Test]
28
+ public void PublicExtensionMethodsAccessible()
29
+ {
30
+ MethodInfo method = typeof(ContainerRelationalExtensions).GetMethod(
31
+ "AssignRelationalComponents",
32
+ BindingFlags.Public | BindingFlags.Static
33
+ );
34
+ Assert.NotNull(
35
+ method,
36
+ "AssignRelationalComponents extension method should be discoverable."
37
+ );
38
+ }
39
+ }
40
+ }
41
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: be28160f00704d01958d9e3bed51c740
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "WallstopStudios.UnityHelpers.Tests.Editor.Reflex",
3
+ "rootNamespace": "WallstopStudios.UnityHelpers.Tests.Integrations.Reflex",
4
+ "references": [
5
+ "UnityEditor.TestRunner",
6
+ "UnityEngine.TestRunner",
7
+ "WallstopStudios.UnityHelpers",
8
+ "WallstopStudios.UnityHelpers.Integration.Reflex",
9
+ "WallstopStudios.UnityHelpers.Tests.Editor",
10
+ "Reflex"
11
+ ],
12
+ "includePlatforms": ["Editor"],
13
+ "excludePlatforms": [],
14
+ "allowUnsafeCode": false,
15
+ "overrideReferences": true,
16
+ "precompiledReferences": ["nunit.framework.dll"],
17
+ "autoReferenced": false,
18
+ "defineConstraints": ["UNITY_INCLUDE_TESTS", "REFLEX_PRESENT"],
19
+ "versionDefines": [
20
+ {
21
+ "name": "com.gustavopsantos.reflex",
22
+ "expression": "0.0.1",
23
+ "define": "REFLEX_PRESENT"
24
+ }
25
+ ],
26
+ "noEngineReferences": false
27
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 1af741409dac4694ad2c4d35e798679f
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 4821446a6f2c40c794be98d03bcfbdb7
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -34,20 +34,19 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.VContainer
34
34
 
35
35
  AttributeMetadataCache cache = CreateScriptableObject<AttributeMetadataCache>();
36
36
  #if UNITY_EDITOR
37
- AttributeMetadataCache.RelationalTypeMetadata relationalMetadata =
38
- new AttributeMetadataCache.RelationalTypeMetadata(
39
- typeof(Consumer).AssemblyQualifiedName,
40
- new[]
41
- {
42
- new AttributeMetadataCache.RelationalFieldMetadata(
43
- "_spriteRenderer",
44
- AttributeMetadataCache.RelationalAttributeKind.Sibling,
45
- AttributeMetadataCache.FieldKind.Single,
46
- typeof(SpriteRenderer).AssemblyQualifiedName,
47
- false
48
- ),
49
- }
50
- );
37
+ AttributeMetadataCache.RelationalTypeMetadata relationalMetadata = new(
38
+ typeof(Consumer).AssemblyQualifiedName,
39
+ new[]
40
+ {
41
+ new AttributeMetadataCache.RelationalFieldMetadata(
42
+ "_spriteRenderer",
43
+ AttributeMetadataCache.RelationalAttributeKind.Sibling,
44
+ AttributeMetadataCache.FieldKind.Single,
45
+ typeof(SpriteRenderer).AssemblyQualifiedName,
46
+ false
47
+ ),
48
+ }
49
+ );
51
50
 
52
51
  cache.SetMetadata(
53
52
  System.Array.Empty<string>(),
@@ -55,10 +54,11 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.VContainer
55
54
  new[] { relationalMetadata }
56
55
  );
57
56
  cache.ForceRebuildForTests();
57
+ yield return null;
58
58
  #endif
59
59
 
60
- RelationalComponentAssigner assigner = new RelationalComponentAssigner(cache);
61
- RelationalComponentEntryPoint entry = new RelationalComponentEntryPoint(
60
+ RelationalComponentAssigner assigner = new(cache);
61
+ RelationalComponentEntryPoint entry = new(
62
62
  assigner,
63
63
  cache,
64
64
  RelationalSceneAssignmentOptions.Default
@@ -69,8 +69,11 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.VContainer
69
69
  // Allow assignment to complete
70
70
  yield return null;
71
71
 
72
- Assert.NotNull(consumer);
73
- Assert.NotNull(consumer.SR, "Relational field should be assigned by entry point");
72
+ Assert.IsTrue(consumer != null);
73
+ Assert.IsTrue(
74
+ consumer.SR != null,
75
+ "Relational field should be assigned by entry point"
76
+ );
74
77
  }
75
78
  }
76
79
  }
@@ -0,0 +1,164 @@
1
+ #if VCONTAINER_PRESENT
2
+ namespace WallstopStudios.UnityHelpers.Tests.Integrations.VContainer
3
+ {
4
+ using global::VContainer;
5
+ using NUnit.Framework;
6
+ using UnityEngine;
7
+ using WallstopStudios.UnityHelpers.Core.Attributes;
8
+ using WallstopStudios.UnityHelpers.Integrations.VContainer;
9
+ using WallstopStudios.UnityHelpers.Tags;
10
+ using WallstopStudios.UnityHelpers.Tests.Editor.Utils;
11
+
12
+ public sealed class VContainerRelationalHelpersTests : CommonTestBase
13
+ {
14
+ private sealed class TestComponent : MonoBehaviour
15
+ {
16
+ [ParentComponent(OnlyAncestors = true)]
17
+ public Rigidbody parentBody;
18
+
19
+ [ChildComponent(OnlyDescendants = true)]
20
+ public CapsuleCollider childCollider;
21
+ }
22
+
23
+ [Test]
24
+ public void InjectWithRelationsAssignsFields()
25
+ {
26
+ ContainerBuilder builder = new();
27
+ IObjectResolver resolver = builder.Build();
28
+
29
+ // Build hierarchy: Parent(Rigidbody) -> Middle(TestComponent) -> Child(CapsuleCollider)
30
+ GameObject parent = NewGameObject("Parent");
31
+ parent.AddComponent<Rigidbody>();
32
+ GameObject middle = NewGameObject("Middle");
33
+ middle.transform.SetParent(parent.transform);
34
+ TestComponent comp = middle.AddComponent<TestComponent>();
35
+ GameObject child = NewGameObject("Child");
36
+ child.transform.SetParent(middle.transform);
37
+ child.AddComponent<CapsuleCollider>();
38
+
39
+ TestComponent result = resolver.InjectWithRelations(comp);
40
+
41
+ Assert.That(result, Is.SameAs(comp));
42
+ Assert.IsTrue(comp.parentBody != null);
43
+ Assert.IsTrue(comp.childCollider != null);
44
+ }
45
+
46
+ [Test]
47
+ public void InstantiateComponentWithRelationsAssignsFields()
48
+ {
49
+ ContainerBuilder builder = new();
50
+ IObjectResolver resolver = builder.Build();
51
+
52
+ // Build prefab hierarchy: Root(Rigidbody) -> Middle(TestComponent) -> Child(CapsuleCollider)
53
+ GameObject prefabRoot = NewGameObject("PrefabRoot");
54
+ prefabRoot.AddComponent<Rigidbody>();
55
+ GameObject prefabMiddle = NewGameObject("PrefabMiddle");
56
+ prefabMiddle.transform.SetParent(prefabRoot.transform);
57
+ TestComponent prefabComp = prefabMiddle.AddComponent<TestComponent>();
58
+ GameObject prefabChild = NewGameObject("PrefabChild");
59
+ prefabChild.transform.SetParent(prefabMiddle.transform);
60
+ prefabChild.AddComponent<CapsuleCollider>();
61
+
62
+ // Instantiate the full hierarchy and hydrate via GO helper
63
+ GameObject instanceRoot = resolver.InstantiateGameObjectWithRelations(prefabRoot);
64
+ TestComponent instance = instanceRoot.GetComponentInChildren<TestComponent>(true);
65
+
66
+ Assert.IsTrue(instance != null);
67
+ Assert.IsTrue(instance.parentBody != null);
68
+ Assert.IsTrue(instance.childCollider != null);
69
+ }
70
+
71
+ [Test]
72
+ public void InjectGameObjectWithRelationsAssignsHierarchy()
73
+ {
74
+ ContainerBuilder builder = new();
75
+ IObjectResolver resolver = builder.Build();
76
+
77
+ GameObject root = NewGameObject("Root");
78
+ root.AddComponent<Rigidbody>();
79
+ GameObject middle = NewGameObject("Middle");
80
+ middle.transform.SetParent(root.transform);
81
+ TestComponent comp = middle.AddComponent<TestComponent>();
82
+ GameObject child = NewGameObject("Child");
83
+ child.transform.SetParent(middle.transform);
84
+ child.AddComponent<CapsuleCollider>();
85
+
86
+ resolver.InjectGameObjectWithRelations(root);
87
+
88
+ Assert.IsTrue(comp.parentBody != null);
89
+ Assert.IsTrue(comp.childCollider != null);
90
+ }
91
+
92
+ [Test]
93
+ public void InstantiateGameObjectWithRelationsAssignsHierarchy()
94
+ {
95
+ ContainerBuilder builder = new();
96
+ IObjectResolver resolver = builder.Build();
97
+
98
+ GameObject prefab = NewGameObject("PrefabRoot");
99
+ prefab.AddComponent<Rigidbody>();
100
+ GameObject mid = NewGameObject("PrefabMiddle");
101
+ mid.transform.SetParent(prefab.transform);
102
+ TestComponent prefabComp = mid.AddComponent<TestComponent>();
103
+ GameObject child = NewGameObject("PrefabChild");
104
+ child.transform.SetParent(mid.transform);
105
+ child.AddComponent<CapsuleCollider>();
106
+
107
+ GameObject instance = resolver.InstantiateGameObjectWithRelations(prefab);
108
+ TestComponent comp = instance.GetComponentInChildren<TestComponent>(true);
109
+
110
+ Assert.IsTrue(comp != null);
111
+ Assert.IsTrue(comp.parentBody != null);
112
+ Assert.IsTrue(comp.childCollider != null);
113
+ }
114
+
115
+ [Test]
116
+ public void AssignerRecognizesBaseTypeMetadataForDerivedComponents()
117
+ {
118
+ AttributeMetadataCache cache = CreateScriptableObject<AttributeMetadataCache>();
119
+
120
+ AttributeMetadataCache.RelationalFieldMetadata[] fields =
121
+ {
122
+ new(
123
+ nameof(BaseWithSibling._spriteRenderer),
124
+ AttributeMetadataCache.RelationalAttributeKind.Sibling,
125
+ AttributeMetadataCache.FieldKind.Single,
126
+ typeof(SpriteRenderer).AssemblyQualifiedName,
127
+ false
128
+ ),
129
+ };
130
+ AttributeMetadataCache.RelationalTypeMetadata[] relational =
131
+ {
132
+ new(typeof(BaseWithSibling).AssemblyQualifiedName, fields),
133
+ };
134
+ cache._relationalTypeMetadata = relational;
135
+ cache.ForceRebuildForTests();
136
+
137
+ ContainerBuilder builder = new();
138
+ builder.RegisterInstance(cache).AsSelf();
139
+ builder
140
+ .RegisterInstance(new RelationalComponentAssigner(cache))
141
+ .As<IRelationalComponentAssigner>();
142
+ IObjectResolver resolver = builder.Build();
143
+
144
+ GameObject go = NewGameObject("Root");
145
+ go.AddComponent<SpriteRenderer>();
146
+ DerivedWithSibling comp = go.AddComponent<DerivedWithSibling>();
147
+
148
+ resolver.AssignRelationalComponents(comp);
149
+
150
+ Assert.IsTrue(comp.SR != null);
151
+ }
152
+
153
+ private class BaseWithSibling : MonoBehaviour
154
+ {
155
+ [SiblingComponent]
156
+ protected internal SpriteRenderer _spriteRenderer;
157
+
158
+ public SpriteRenderer SR => _spriteRenderer;
159
+ }
160
+
161
+ private sealed class DerivedWithSibling : BaseWithSibling { }
162
+ }
163
+ }
164
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 96ae7f33720de924cb793c45e98b66e5
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -6,7 +6,8 @@
6
6
  "UnityEngine.TestRunner",
7
7
  "WallstopStudios.UnityHelpers",
8
8
  "WallstopStudios.UnityHelpers.Integration.VContainer",
9
- "WallstopStudios.UnityHelpers.Tests.Editor"
9
+ "WallstopStudios.UnityHelpers.Tests.Editor",
10
+ "VContainer"
10
11
  ],
11
12
  "includePlatforms": ["Editor"],
12
13
  "excludePlatforms": [],