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
@@ -2,20 +2,129 @@ namespace Samples.UnityHelpers.DI.VContainer
2
2
  {
3
3
  using global::VContainer;
4
4
  using UnityEngine;
5
+ using UnityEngine.Pool;
5
6
  using WallstopStudios.UnityHelpers.Integrations.VContainer;
6
7
 
7
8
  public sealed class Spawner : MonoBehaviour
8
9
  {
9
10
  [SerializeField]
10
- private RelationalConsumer _prefab;
11
+ private RelationalConsumer _componentPrefab;
12
+
13
+ [SerializeField]
14
+ private GameObject _hierarchyPrefab;
15
+
16
+ [SerializeField]
17
+ private Transform _defaultParent;
11
18
 
12
19
  [Inject]
13
20
  private IObjectResolver _resolver;
14
21
 
15
- public RelationalConsumer Build(Transform parent)
22
+ private ObjectPool<RelationalConsumer> _componentPool;
23
+
24
+ private void Awake()
25
+ {
26
+ _componentPool = RelationalObjectPools.CreatePoolWithRelations(
27
+ createFunc: () => Instantiate(_componentPrefab),
28
+ actionOnGet: OnGetFromPool,
29
+ actionOnRelease: OnReleaseToPool
30
+ );
31
+ }
32
+
33
+ /// <summary>
34
+ /// Instantiate a component prefab through VContainer so dependencies and relational fields
35
+ /// are populated in one call.
36
+ /// </summary>
37
+ public RelationalConsumer SpawnComponent(Transform parent)
38
+ {
39
+ Transform targetParent = parent != null ? parent : _defaultParent;
40
+ RelationalConsumer instance = _resolver.InstantiateComponentWithRelations(
41
+ _componentPrefab,
42
+ targetParent
43
+ );
44
+ return instance;
45
+ }
46
+
47
+ /// <summary>
48
+ /// Instantiate a hierarchy prefab and hydrate every attributed component beneath it.
49
+ /// </summary>
50
+ public GameObject SpawnHierarchy(Transform parent)
51
+ {
52
+ Transform targetParent = parent != null ? parent : _defaultParent;
53
+ GameObject root = _resolver.InstantiateGameObjectWithRelations(
54
+ _hierarchyPrefab,
55
+ targetParent,
56
+ includeInactiveChildren: true
57
+ );
58
+ return root;
59
+ }
60
+
61
+ /// <summary>
62
+ /// Rent a component from a simple pool, then inject and assign it through the resolver.
63
+ /// </summary>
64
+ public RelationalConsumer SpawnFromPool(Transform parent)
65
+ {
66
+ Transform targetParent = parent != null ? parent : _defaultParent;
67
+ RelationalConsumer instance = _componentPool.GetWithRelations(_resolver);
68
+ if (targetParent != null)
69
+ {
70
+ instance.transform.SetParent(targetParent, false);
71
+ }
72
+ return instance;
73
+ }
74
+
75
+ /// <summary>
76
+ /// Return an instance to the pool.
77
+ /// </summary>
78
+ public void ReturnToPool(RelationalConsumer instance)
79
+ {
80
+ if (instance == null)
81
+ {
82
+ return;
83
+ }
84
+
85
+ _componentPool.Release(instance);
86
+ }
87
+
88
+ /// <summary>
89
+ /// Hydrate an existing hierarchy that was created outside of the resolver (e.g., scene tools).
90
+ /// </summary>
91
+ public void HydrateExistingHierarchy(GameObject root)
92
+ {
93
+ if (root == null)
94
+ {
95
+ return;
96
+ }
97
+
98
+ _resolver.AssignRelationalHierarchy(root, includeInactiveChildren: true);
99
+ }
100
+
101
+ private void OnGetFromPool(RelationalConsumer consumer)
102
+ {
103
+ if (consumer == null)
104
+ {
105
+ return;
106
+ }
107
+
108
+ consumer.gameObject.SetActive(true);
109
+ }
110
+
111
+ private void OnReleaseToPool(RelationalConsumer consumer)
112
+ {
113
+ if (consumer == null)
114
+ {
115
+ return;
116
+ }
117
+
118
+ consumer.gameObject.SetActive(false);
119
+ }
120
+
121
+ private void OnDestroy()
16
122
  {
17
- RelationalConsumer instance = Instantiate(_prefab, parent);
18
- return _resolver.BuildUpWithRelations(instance);
123
+ if (_componentPool != null)
124
+ {
125
+ _componentPool.Clear();
126
+ _componentPool = null;
127
+ }
19
128
  }
20
129
  }
21
130
  }
@@ -2,17 +2,23 @@
2
2
 
3
3
  ## Why This Integration Matters
4
4
 
5
- **The Problem:** When using dependency injection with Zenject, you often need to wire up both:
6
- 1. **Dependencies** (injected via constructor/properties/fields)
7
- 2. **Hierarchy references** (SpriteRenderer, Rigidbody2D, child colliders, etc.)
5
+ **Stop Writing GetComponent Boilerplate in Every Single Script**
8
6
 
9
- Doing this manually means writing boilerplate in every component.
7
+ When using dependency injection with Zenject, you've solved half the problem - your service dependencies get injected cleanly. But you're **still stuck** writing repetitive `GetComponent` boilerplate for hierarchy references in every. single. MonoBehaviour.
10
8
 
11
- **The Solution:** Unity Helpers' Zenject integration automatically wires up relational component fields **right after** DI injection completes - giving you the best of both worlds with zero extra code.
9
+ **The Painful Reality:**
10
+
11
+ 1. **Dependencies** → ✅ Handled by Zenject (IHealthSystem, IAudioService, etc.)
12
+ 2. **Hierarchy references** → ❌ Still manual hell (SpriteRenderer, Rigidbody2D, child colliders, etc.)
13
+
14
+ You're using a modern DI framework but still writing 2008-era Unity boilerplate. **Unity Helpers fixes this.**
15
+
16
+ **The Solution:** This integration automatically wires up relational component fields **right after** DI injection completes - giving you the best of both worlds with **literally zero extra code per component**.
12
17
 
13
18
  ### ⚡ Quick Example: Before vs After
14
19
 
15
20
  **Before (Manual):**
21
+
16
22
  ```csharp
17
23
  public class Enemy : MonoBehaviour
18
24
  {
@@ -36,6 +42,7 @@ public class Enemy : MonoBehaviour
36
42
  ```
37
43
 
38
44
  **After (With Integration):**
45
+
39
46
  ```csharp
40
47
  public class Enemy : MonoBehaviour
41
48
  {
@@ -50,7 +57,9 @@ public class Enemy : MonoBehaviour
50
57
  }
51
58
  ```
52
59
 
53
- **Time Saved:** 10-20 lines of boilerplate per component × hundreds of components = **weeks** of development time.
60
+ **⏱️ Time Saved:** 10-20 lines of boilerplate per component × hundreds of components = **weeks** of development time.
61
+ **🧠 Mental Load Eliminated:** No more context-switching between DI patterns and Unity hierarchy patterns.
62
+ **🐛 Bugs Prevented:** Automatic validation catches missing references **before** they cause runtime errors.
54
63
 
55
64
  ---
56
65
 
@@ -60,37 +69,47 @@ public class Enemy : MonoBehaviour
60
69
 
61
70
  1. Add a `SceneContext` to your scene (if you don't have one already)
62
71
  2. Add the `RelationalComponentsInstaller` component to the same GameObject
63
- 3. *(Optional)* Toggle **"Assign Scene On Initialize"** to automatically wire all scene components after the container builds
72
+ 3. Enable **"Assign Scene On Initialize"** to automatically wire all scene components after the container builds (recommended)
64
73
 
65
74
  ![SceneContext Setup](../../Docs/Images/zenject_setup.png)
66
75
 
76
+ > 💡 **Beginner tip:** Enable both checkboxes in the inspector:
77
+ >
78
+ > - ✅ **Assign Scene On Initialize** → Auto-wires all scene objects (saves you from calling it manually)
79
+ > - ✅ **Listen For Additive Scenes** → Auto-wires newly loaded scenes (great for multi-scene setups)
80
+
67
81
  ### Step 2: Use With Prefab Instantiation
68
82
 
69
- When spawning prefabs at runtime, use `InstantiateComponentWithRelations` instead of regular Zenject instantiation:
83
+ When spawning prefabs at runtime, use the helpers that combine instantiation, DI, and relational assignment:
70
84
 
71
85
  ```csharp
72
86
  using UnityEngine;
73
87
  using Zenject;
74
88
  using WallstopStudios.UnityHelpers.Integrations.Zenject;
75
89
 
76
- public class EnemySpawner : MonoBehaviour
90
+ public sealed class EnemySpawner : MonoBehaviour
77
91
  {
78
92
  [Inject] private DiContainer _container;
79
93
  [SerializeField] private Enemy _enemyPrefab;
94
+ [SerializeField] private GameObject _enemySquadPrefab;
80
95
 
81
- public void SpawnEnemy(Vector3 position)
96
+ public Enemy SpawnEnemy(Transform parent)
82
97
  {
83
- // Performs DI injection AND relational component wiring
84
- Enemy enemy = _container.InstantiateComponentWithRelations(
85
- _enemyPrefab,
86
- position,
87
- Quaternion.identity,
88
- parentTransform: null
98
+ return _container.InstantiateComponentWithRelations(_enemyPrefab, parent);
99
+ }
100
+
101
+ public GameObject SpawnEnemySquad(Transform parent)
102
+ {
103
+ return _container.InstantiateGameObjectWithRelations(
104
+ _enemySquadPrefab,
105
+ parent,
106
+ includeInactiveChildren: true
89
107
  );
108
+ }
90
109
 
91
- // enemy._healthSystem is injected
92
- // enemy._animator, enemy._rigidbody are auto-wired
93
- // Ready to use immediately!
110
+ public void HydrateExisting(GameObject root)
111
+ {
112
+ _container.AssignRelationalHierarchy(root, includeInactiveChildren: true);
94
113
  }
95
114
  }
96
115
  ```
@@ -103,7 +122,8 @@ public class EnemySpawner : MonoBehaviour
103
122
 
104
123
  This sample provides a complete working example:
105
124
 
106
- - **Scripts/SpawnerZenject.cs** - Runtime instantiation using `InstantiateComponentWithRelations()`
125
+ - **Scripts/SpawnerZenject.cs** - Demonstrates `InstantiateComponentWithRelations`, `InstantiateGameObjectWithRelations`, optional pooling, and hierarchy hydration
126
+ - **Scripts/RelationalConsumerPool.cs** - Minimal `RelationalMemoryPool` implementation for use with Zenject memory pools
107
127
  - **Scripts/RelationalConsumer.cs** - Component demonstrating relational attributes
108
128
  - **Prefabs/RelationalConsumer.prefab** - Example prefab with relational fields
109
129
  - **Prefabs/SpawnerZenject.prefab** - Spawner prefab showing runtime usage
@@ -119,11 +139,15 @@ This sample provides a complete working example:
119
139
 
120
140
  ---
121
141
 
122
- ## 🎯 Common Use Cases
142
+ ## 🎯 Common Use Cases (By Experience Level)
143
+
144
+ ### 🟢 Beginner: "I just want my components to work"
145
+
146
+ **Perfect for:** Player controllers, enemy AI, simple gameplay scripts
123
147
 
124
- ### Scene Objects with Both DI and Hierarchy References
148
+ **What you get:** No more `GetComponent` calls, no more null reference exceptions from missing components
125
149
 
126
- Perfect for player controllers, managers, and gameplay systems:
150
+ **Example:**
127
151
 
128
152
  ```csharp
129
153
  public class PlayerController : MonoBehaviour
@@ -150,56 +174,56 @@ public class PlayerController : MonoBehaviour
150
174
 
151
175
  **Important:** Enable **"Assign Scene On Initialize"** in the `RelationalComponentsInstaller` for automatic scene wiring.
152
176
 
153
- ### Runtime-Spawned Prefabs
177
+ ### 🟡 Intermediate: "I'm spawning objects at runtime"
154
178
 
155
- For enemies, projectiles, and dynamic objects:
179
+ **Perfect for:** Enemy spawners, projectile systems, object pooling
180
+
181
+ **What you get:** One-line instantiation that handles DI injection + hierarchy wiring automatically
182
+
183
+ **Example:**
156
184
 
157
185
  ```csharp
158
- public class ProjectileSpawner : MonoBehaviour
186
+ public sealed class ProjectileSpawner : MonoBehaviour
159
187
  {
160
188
  [Inject] private DiContainer _container;
161
189
  [SerializeField] private Projectile _projectilePrefab;
162
190
 
163
- public void Fire(Vector3 position, Vector3 direction)
191
+ public Projectile Fire(Vector3 position, Vector3 direction)
164
192
  {
165
- // Both DI injection and relational component wiring happen here
166
- Projectile projectile = _container.InstantiateComponentWithRelations(
167
- _projectilePrefab,
168
- position,
169
- Quaternion.LookRotation(direction)
170
- );
171
-
193
+ Projectile projectile = _container.InstantiateComponentWithRelations(_projectilePrefab);
194
+ projectile.transform.SetPositionAndRotation(position, Quaternion.LookRotation(direction));
172
195
  projectile.Launch(direction);
196
+ return projectile;
173
197
  }
174
198
  }
175
199
  ```
176
200
 
177
- ### Complex Prefab Hierarchies
201
+ ### 🔴 Advanced: "I have complex hierarchies and custom workflows"
178
202
 
179
- For UI panels, vehicles, or multi-part systems:
203
+ **Perfect for:** UI systems, vehicles with multiple parts, procedural generation, custom factories
204
+
205
+ **What you get:** Full control over when and how wiring happens, with helpers for every scenario
206
+
207
+ **Example - Complex Prefabs:**
180
208
 
181
209
  ```csharp
182
- public class VehicleFactory : MonoBehaviour
210
+ public sealed class VehicleFactory : MonoBehaviour
183
211
  {
184
212
  [Inject] private DiContainer _container;
185
213
  [SerializeField] private GameObject _vehiclePrefab;
186
214
 
187
215
  public GameObject CreateVehicle()
188
216
  {
189
- // Instantiate with DI
190
- GameObject vehicle = _container.InstantiatePrefab(_vehiclePrefab);
191
-
192
- // Wire up entire hierarchy - all nested components get relational wiring
193
- _container.AssignRelationalHierarchy(vehicle, includeInactiveChildren: true);
194
-
195
- return vehicle;
217
+ return _container.InstantiateGameObjectWithRelations(
218
+ _vehiclePrefab,
219
+ parent: null,
220
+ includeInactiveChildren: true
221
+ );
196
222
  }
197
223
  }
198
224
  ```
199
225
 
200
- ### Factory Pattern with Relational Components
201
-
202
- Combine Zenject factories with relational wiring:
226
+ **Example - Custom Factories:**
203
227
 
204
228
  ```csharp
205
229
  public class EnemyFactory : PlaceholderFactory<Enemy>
@@ -221,6 +245,81 @@ Container.BindFactory<Enemy, EnemyFactory>()
221
245
 
222
246
  ---
223
247
 
248
+ ## 💡 Real-World Impact: A Day in the Life
249
+
250
+ ### Without This Integration
251
+
252
+ **Morning:** You start work on a new enemy type.
253
+
254
+ ```csharp
255
+ public class FlyingEnemy : MonoBehaviour
256
+ {
257
+ [Inject] private IHealthSystem _health;
258
+ [Inject] private IAudioService _audio;
259
+
260
+ private Animator _animator;
261
+ private Rigidbody2D _rigidbody;
262
+ private SpriteRenderer _sprite;
263
+ private Collider2D[] _hitboxes;
264
+ private Transform _weaponMount;
265
+
266
+ void Awake()
267
+ {
268
+ _animator = GetComponent<Animator>();
269
+ if (_animator == null) Debug.LogError("Missing Animator on FlyingEnemy!");
270
+
271
+ _rigidbody = GetComponent<Rigidbody2D>();
272
+ if (_rigidbody == null) Debug.LogError("Missing Rigidbody2D on FlyingEnemy!");
273
+
274
+ _sprite = GetComponent<SpriteRenderer>();
275
+ if (_sprite == null) Debug.LogError("Missing SpriteRenderer on FlyingEnemy!");
276
+
277
+ _hitboxes = GetComponentsInChildren<Collider2D>();
278
+ if (_hitboxes.Length == 0) Debug.LogWarning("No hitboxes found on FlyingEnemy!");
279
+
280
+ _weaponMount = transform.Find("WeaponMount");
281
+ if (_weaponMount == null) Debug.LogError("Missing WeaponMount on FlyingEnemy!");
282
+
283
+ // Finally, actual game logic can start...
284
+ }
285
+ }
286
+ ```
287
+
288
+ **10 minutes later:** You've written 20+ lines of boilerplate before writing any actual game logic.
289
+
290
+ **30 minutes later:** Null reference exception in the build! You forgot to add the SpriteRenderer to the prefab.
291
+
292
+ **60 minutes later:** You're manually wiring up the 8th enemy variant of the day...
293
+
294
+ ### With This Integration
295
+
296
+ **Morning:** You start work on a new enemy type.
297
+
298
+ ```csharp
299
+ public class FlyingEnemy : MonoBehaviour
300
+ {
301
+ [Inject] private IHealthSystem _health;
302
+ [Inject] private IAudioService _audio;
303
+
304
+ [SiblingComponent] private Animator _animator;
305
+ [SiblingComponent] private Rigidbody2D _rigidbody;
306
+ [SiblingComponent] private SpriteRenderer _sprite;
307
+ [ChildComponent] private Collider2D[] _hitboxes;
308
+ [ChildComponent(NameFilter = "WeaponMount")] private Transform _weaponMount;
309
+
310
+ // Start writing game logic immediately
311
+ void Start() => _animator.Play("Idle");
312
+ }
313
+ ```
314
+
315
+ **2 minutes later:** You're done with wiring and writing game logic.
316
+
317
+ **10 minutes later:** You've shipped 5 enemy variants with zero boilerplate.
318
+
319
+ **Never:** You never see "Missing component" runtime errors because validation happens automatically with helpful messages.
320
+
321
+ ---
322
+
224
323
  ## 🔧 Advanced Configuration
225
324
 
226
325
  ### RelationalComponentsInstaller Options
@@ -228,6 +327,7 @@ Container.BindFactory<Enemy, EnemyFactory>()
228
327
  The installer component provides these settings:
229
328
 
230
329
  **Assign Scene On Initialize** *(default: true)*
330
+
231
331
  - When enabled, automatically wires all scene components with relational attributes after the container builds
232
332
  - Disable if you want to manually control when scene wiring happens
233
333
 
@@ -276,11 +376,68 @@ Container.BindInterfacesTo<GameBootstrap>().AsSingle();
276
376
  ```
277
377
 
278
378
  Or enable auto-prewarm on the `AttributeMetadataCache` asset:
379
+
279
380
  1. Create: `Assets > Create > Wallstop Studios > Unity Helpers > Attribute Metadata Cache`
280
381
  2. Enable **"Prewarm Relational On Load"** in the Inspector
281
382
 
282
383
  ---
283
384
 
385
+ ## 🧰 Additional Helpers & Recipes
386
+
387
+ ### One-liners for DI + Relational Wiring
388
+
389
+ ```csharp
390
+ // Inject + assign a single component
391
+ Container.InjectWithRelations(component);
392
+
393
+ // Instantiate a component prefab + assign
394
+ var comp = Container.InstantiateComponentWithRelations(prefabComp, parent);
395
+
396
+ // Inject + assign a whole hierarchy
397
+ Container.InjectGameObjectWithRelations(root, includeInactiveChildren: true);
398
+
399
+ // Instantiate a GameObject prefab + inject + assign hierarchy
400
+ var go = Container.InstantiateGameObjectWithRelations(prefabGo, parent);
401
+ ```
402
+
403
+ ### Additive Scenes & Options
404
+
405
+ In the `RelationalComponentsInstaller`, enable “Assign Scene On Initialize” and “Listen For Additive Scenes”. You can also control scanning behavior via options:
406
+
407
+ ```csharp
408
+ public sealed class GameInstaller : MonoInstaller
409
+ {
410
+ public override void InstallBindings()
411
+ {
412
+ // Bind assigner (done by installer automatically if used)
413
+ // Container.Bind<IRelationalComponentAssigner>().To<RelationalComponentAssigner>().AsSingle();
414
+
415
+ // Configure scan options used by the initializer/listener
416
+ Container.BindInstance(new RelationalSceneAssignmentOptions(
417
+ includeInactive: true,
418
+ useSinglePassScan: true
419
+ ));
420
+
421
+ // Register initializer + additive scene listener (installer toggles also available)
422
+ Container.BindInterfacesTo<RelationalComponentSceneInitializer>().AsSingle();
423
+ Container.BindInterfacesTo<RelationalSceneLoadListener>().AsSingle();
424
+ }
425
+ }
426
+ ```
427
+
428
+ ### Pools
429
+
430
+ Use DI-aware Zenject memory pools to assign on spawn automatically:
431
+
432
+ ```csharp
433
+ public class EnemyPool : RelationalMemoryPool<Enemy> {}
434
+
435
+ // Or with a spawn parameter
436
+ public class BulletPool : RelationalMemoryPool<Vector3, Bullet> {}
437
+ ```
438
+
439
+ ---
440
+
284
441
  ## ❓ Troubleshooting
285
442
 
286
443
  ### My relational fields are null even with the integration
@@ -293,15 +450,15 @@ Or enable auto-prewarm on the `AttributeMetadataCache` asset:
293
450
 
294
451
  2. **Scene components not wired?**
295
452
  - Enable **"Assign Scene On Initialize"** in the `RelationalComponentsInstaller`
296
- - Or manually call `_container.AssignRelationalComponents(this)` in your component
453
+ - Or manually call `_container.AssignRelationalHierarchy(gameObject, includeInactiveChildren: true)` at bootstrap time
297
454
 
298
455
  3. **Are you using the right attributes?**
299
456
  - Fields need `[SiblingComponent]`, `[ParentComponent]`, or `[ChildComponent]` attributes
300
457
  - These are different from `[Inject]` - you can use both on the same component
301
458
 
302
459
  4. **Runtime instantiation not working?**
303
- - Use `_container.InstantiateComponentWithRelations()` instead of regular Zenject methods
304
- - Regular `InstantiatePrefab()` won't trigger relational wiring
460
+ - Use `_container.InstantiateComponentWithRelations(...)`, `_container.InstantiateGameObjectWithRelations(...)`, or `_container.AssignRelationalHierarchy(...)`
461
+ - Regular `InstantiatePrefab()`/`InstantiatePrefabForComponent()` won't trigger relational wiring without these helpers
305
462
 
306
463
  5. **Check your filters:**
307
464
  - `TagFilter` must match an existing Unity tag exactly
@@ -310,14 +467,16 @@ Or enable auto-prewarm on the `AttributeMetadataCache` asset:
310
467
  ### Do I need to call AssignRelationalComponents() in Awake()?
311
468
 
312
469
  **No!** The integration handles this automatically:
470
+
313
471
  - **Scene objects:** Wired when you enable "Assign Scene On Initialize" (recommended)
314
- - **Runtime objects:** Wired when you call `InstantiateComponentWithRelations()`
472
+ - **Runtime objects:** Wired when you call any of the helper methods (`InstantiateComponentWithRelations`, `InstantiateGameObjectWithRelations`, `AssignRelationalHierarchy`, or the pooling helpers built on `RelationalMemoryPool`)
315
473
 
316
474
  Only call `AssignRelationalComponents()` manually if you need fine-grained control.
317
475
 
318
476
  ### Does this work without Zenject?
319
477
 
320
478
  **Yes!** The integration gracefully falls back to standard Unity Helpers behavior if Zenject isn't detected. You can:
479
+
321
480
  - Adopt incrementally without breaking existing code
322
481
  - Use in projects that mix DI and non-DI components
323
482
  - Remove Zenject later without refactoring all your components
@@ -327,6 +486,7 @@ Only call `AssignRelationalComponents()` manually if you need fine-grained contr
327
486
  **Minimal:** Relational component assignment happens once per component at initialization time. After that, there's zero runtime overhead - the references are just regular fields.
328
487
 
329
488
  **Optimization tips:**
489
+
330
490
  - Use `MaxDepth` to limit hierarchy traversal
331
491
  - Use `TagFilter` or `NameFilter` to narrow searches
332
492
  - Use `OnlyDescendants`/`OnlyAncestors` to exclude self when appropriate
@@ -334,6 +494,7 @@ Only call `AssignRelationalComponents()` manually if you need fine-grained contr
334
494
  ### Zenject vs Extenject?
335
495
 
336
496
  This integration works with **all** Zenject variants:
497
+
337
498
  - **Zenject** (original)
338
499
  - **Extenject** (community fork)
339
500
  - **Zenject (Modesttree)** (updated original)
@@ -345,17 +506,20 @@ Unity Helpers automatically detects which one you're using.
345
506
  ## 📚 Learn More
346
507
 
347
508
  **Unity Helpers Documentation:**
348
- - [Relational Components Guide](../../RELATIONAL_COMPONENTS.md) - Complete attribute reference and recipes
349
- - [Getting Started](../../GETTING_STARTED.md) - Unity Helpers quick start guide
509
+
510
+ - [Relational Components Guide](../../Docs/RELATIONAL_COMPONENTS.md) - Complete attribute reference and recipes
511
+ - [Getting Started](../../Docs/GETTING_STARTED.md) - Unity Helpers quick start guide
350
512
  - [Main README](../../README.md) - Full feature overview
351
513
 
352
514
  **Zenject Documentation:**
515
+
353
516
  - [Zenject GitHub](https://github.com/modesttree/Zenject) - Official Zenject documentation
354
517
  - [Extenject GitHub](https://github.com/svermeulen/Extenject) - Community fork with updates
355
518
 
356
519
  **Troubleshooting:**
357
- - [Relational Components Troubleshooting](../../RELATIONAL_COMPONENTS.md#troubleshooting) - Detailed solutions
358
- - [DI Integration Testing Guide](../../RELATIONAL_COMPONENTS.md#di-integrations-testing-and-edge-cases) - Advanced scenarios
520
+
521
+ - [Relational Components Troubleshooting](../../Docs/RELATIONAL_COMPONENTS.md#troubleshooting) - Detailed solutions
522
+ - [DI Integration Testing Guide](../../Docs/RELATIONAL_COMPONENTS.md#di-integrations-testing-and-edge-cases) - Advanced scenarios
359
523
 
360
524
  ---
361
525
 
@@ -364,7 +528,7 @@ Unity Helpers automatically detects which one you're using.
364
528
  1. **Try the sample scene:** Open `Zenject_Sample.unity` and press Play
365
529
  2. **Read the scripts:** See how `SpawnerZenject` and `RelationalConsumer` work
366
530
  3. **Add to your project:** Add `RelationalComponentsInstaller` to your `SceneContext`
367
- 4. **Explore attributes:** Check out the [Relational Components Guide](../../RELATIONAL_COMPONENTS.md) for all options
531
+ 4. **Explore attributes:** Check out the [Relational Components Guide](../../Docs/RELATIONAL_COMPONENTS.md) for all options
368
532
 
369
533
  ---
370
534
 
@@ -376,7 +540,7 @@ If you're choosing between Zenject and VContainer, here's how the integrations d
376
540
  |---------|---------|------------|
377
541
  | Setup | Add installer to SceneContext | Call in LifetimeScope.Configure() |
378
542
  | Scene wiring | Toggle on installer | Automatic |
379
- | Runtime instantiation | `InstantiateComponentWithRelations()` | `BuildUpWithRelations()` |
543
+ | Runtime instantiation | `InstantiateComponentWithRelations()`, `InstantiateGameObjectWithRelations()`, `RelationalMemoryPool` helpers | `InstantiateComponentWithRelations()`, `InstantiateGameObjectWithRelations()`, `BuildUpWithRelations()`, `RelationalObjectPools` helpers |
380
544
  | Performance | Good | Slightly faster |
381
545
  | Maintenance | Community-maintained | Actively developed |
382
546
 
@@ -384,6 +548,7 @@ Both integrations provide the same relational component features - choose based
384
548
 
385
549
  ---
386
550
 
387
- **Made with ❤️ by Wallstop Studios**
551
+ ## Made with ❤️ by Wallstop Studios
388
552
 
389
553
  *Unity Helpers is production-ready and actively maintained. [Star the repo](https://github.com/wallstop/unity-helpers) if you find it useful!*
554
+
@@ -3,6 +3,9 @@ namespace Samples.UnityHelpers.DI.Zenject
3
3
  using UnityEngine;
4
4
  using WallstopStudios.UnityHelpers.Core.Attributes;
5
5
 
6
+ /// <summary>
7
+ /// Minimal component that demonstrates relational attributes being resolved by the Zenject integration.
8
+ /// </summary>
6
9
  public sealed class RelationalConsumer : MonoBehaviour
7
10
  {
8
11
  [SiblingComponent]
@@ -0,0 +1,37 @@
1
+ namespace Samples.UnityHelpers.DI.Zenject
2
+ {
3
+ using global::Zenject;
4
+ using UnityEngine;
5
+ using WallstopStudios.UnityHelpers.Integrations.Zenject;
6
+
7
+ /// <summary>
8
+ /// Example Zenject memory pool that automatically hydrates relational fields when items are spawned.
9
+ /// Bind this pool in an installer with
10
+ /// <code>
11
+ /// Container.BindMemoryPool&lt;RelationalConsumer, RelationalConsumerPool&gt;()
12
+ /// .FromComponentInNewPrefab(componentPrefab)
13
+ /// .UnderTransform(poolRoot);
14
+ /// </code>
15
+ /// </summary>
16
+ public sealed class RelationalConsumerPool : RelationalMemoryPool<RelationalConsumer>
17
+ {
18
+ protected override void OnSpawned(RelationalConsumer item)
19
+ {
20
+ base.OnSpawned(item);
21
+ if (item != null)
22
+ {
23
+ item.gameObject.SetActive(true);
24
+ }
25
+ }
26
+
27
+ protected override void OnDespawned(RelationalConsumer item)
28
+ {
29
+ if (item != null)
30
+ {
31
+ item.gameObject.SetActive(false);
32
+ }
33
+
34
+ base.OnDespawned(item);
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,12 @@
1
+ fileFormatVersion: 2
2
+ guid: f5f3d2a1c3e941dca246b1a20f7c9d1b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
12
+