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
@@ -9,6 +9,7 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
9
9
  using WallstopStudios.UnityHelpers.Core.Attributes;
10
10
  using WallstopStudios.UnityHelpers.Tags;
11
11
  using WallstopStudios.UnityHelpers.Utils;
12
+ using Object = UnityEngine.Object;
12
13
 
13
14
  /// <summary>
14
15
  /// Entry point registered with VContainer to hydrate relational attributes once the container is
@@ -71,38 +72,117 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
71
72
 
72
73
  if (relationalTypes.Count == 0)
73
74
  {
75
+ // Fallback: scan all components once and assign when type has relational fields
76
+ bool includeInactiveAll = _options.IncludeInactive;
77
+ Component[] allComponents = includeInactiveAll
78
+ ? Object.FindObjectsOfType<Component>(true)
79
+ : Object.FindObjectsOfType<Component>(false);
80
+
81
+ for (int i = 0; i < allComponents.Length; i++)
82
+ {
83
+ Component c = allComponents[i];
84
+ if (c == null || c.gameObject.scene != SceneManager.GetActiveScene())
85
+ {
86
+ continue;
87
+ }
88
+
89
+ if (_assigner.HasRelationalAssignments(c.GetType()))
90
+ {
91
+ _assigner.Assign(c);
92
+ }
93
+ }
74
94
  return;
75
95
  }
76
96
 
77
97
  bool includeInactive = _options.IncludeInactive;
78
98
  Scene activeScene = SceneManager.GetActiveScene();
79
99
 
80
- foreach (Type componentType in relationalTypes)
100
+ if (_options.UseSinglePassScan)
81
101
  {
82
- if (componentType == null)
102
+ using PooledResource<HashSet<Type>> pooledSet = Buffers<Type>.HashSet.Get(
103
+ out HashSet<Type> relationalSet
104
+ );
105
+ for (int i = 0; i < relationalTypes.Count; i++)
83
106
  {
84
- continue;
107
+ Type t = relationalTypes[i];
108
+ if (t != null)
109
+ {
110
+ relationalSet.Add(t);
111
+ }
85
112
  }
86
113
 
87
- UnityEngine.Object[] located = includeInactive
88
- ? UnityEngine.Object.FindObjectsOfType(componentType, true)
89
- : UnityEngine.Object.FindObjectsOfType(componentType, false);
114
+ Component[] all = includeInactive
115
+ ? Object.FindObjectsOfType<Component>(true)
116
+ : Object.FindObjectsOfType<Component>(false);
90
117
 
91
- foreach (UnityEngine.Object candidate in located)
118
+ for (int i = 0; i < all.Length; i++)
92
119
  {
93
- if (candidate is not Component component)
120
+ Component c = all[i];
121
+ if (c == null || c.gameObject.scene != activeScene)
94
122
  {
95
123
  continue;
96
124
  }
97
125
 
98
- if (component.gameObject.scene != activeScene)
126
+ Type t = c.GetType();
127
+ while (t != null && typeof(Component).IsAssignableFrom(t))
128
+ {
129
+ if (relationalSet.Contains(t))
130
+ {
131
+ _assigner.Assign(c);
132
+ break;
133
+ }
134
+ t = t.BaseType;
135
+ }
136
+ }
137
+ }
138
+ else
139
+ {
140
+ foreach (Type componentType in relationalTypes)
141
+ {
142
+ if (componentType == null)
99
143
  {
100
144
  continue;
101
145
  }
102
146
 
103
- _assigner.Assign(component);
147
+ Object[] located = includeInactive
148
+ ? Object.FindObjectsOfType(componentType, true)
149
+ : Object.FindObjectsOfType(componentType, false);
150
+
151
+ foreach (Object t in located)
152
+ {
153
+ if (t is not Component component)
154
+ {
155
+ continue;
156
+ }
157
+
158
+ if (component.gameObject.scene != activeScene)
159
+ {
160
+ continue;
161
+ }
162
+
163
+ _assigner.Assign(component);
164
+ }
104
165
  }
105
166
  }
167
+
168
+ // Safety net in Editor/tests: also walk scene roots to catch any missed
169
+ #if UNITY_EDITOR
170
+ if (!Application.isPlaying)
171
+ {
172
+ using PooledResource<List<GameObject>> rootGoBuffer = Buffers<GameObject>.List.Get(
173
+ out List<GameObject> roots
174
+ );
175
+ activeScene.GetRootGameObjects(roots);
176
+ foreach (GameObject root in roots)
177
+ {
178
+ if (root == null)
179
+ {
180
+ continue;
181
+ }
182
+ _assigner.AssignHierarchy(root, includeInactive);
183
+ }
184
+ }
185
+ #endif
106
186
  }
107
187
  }
108
188
  }
@@ -14,6 +14,8 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
14
14
  /// <remarks>
15
15
  /// Registers the shared <see cref="IRelationalComponentAssigner"/> as a singleton and schedules a
16
16
  /// scene-wide entry point that hydrates all relational fields after the container has been built.
17
+ /// Optionally wires <see cref="RelationalSceneLoadListener"/> so future additive scenes receive
18
+ /// the same treatment.
17
19
  /// </remarks>
18
20
  public static class RelationalComponentsBuilderExtensions
19
21
  {
@@ -26,6 +28,10 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
26
28
  /// Optional settings to control how the active scene is scanned (e.g., include inactive
27
29
  /// objects). When <c>null</c>, <see cref="RelationalSceneAssignmentOptions.Default"/> is used.
28
30
  /// </param>
31
+ /// <param name="enableAdditiveSceneListener">
32
+ /// When true registers <see cref="RelationalSceneLoadListener"/> so additively loaded scenes
33
+ /// are hydrated with the same options. Disable when you manage additive scenes manually.
34
+ /// </param>
29
35
  /// <example>
30
36
  /// <code>
31
37
  /// using VContainer;
@@ -49,7 +55,8 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
49
55
  /// </example>
50
56
  public static void RegisterRelationalComponents(
51
57
  this IContainerBuilder builder,
52
- RelationalSceneAssignmentOptions? options = null
58
+ RelationalSceneAssignmentOptions? options = null,
59
+ bool enableAdditiveSceneListener = true
53
60
  )
54
61
  {
55
62
  if (builder == null)
@@ -72,6 +79,11 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
72
79
  .AsSelf();
73
80
 
74
81
  builder.RegisterEntryPoint<RelationalComponentEntryPoint>().WithParameter(resolved);
82
+
83
+ if (enableAdditiveSceneListener)
84
+ {
85
+ builder.RegisterEntryPoint<RelationalSceneLoadListener>().WithParameter(resolved);
86
+ }
75
87
  }
76
88
  }
77
89
  }
@@ -0,0 +1,114 @@
1
+ #if VCONTAINER_PRESENT
2
+ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
3
+ {
4
+ using System;
5
+ using global::VContainer;
6
+ using global::VContainer.Unity;
7
+ using UnityEngine;
8
+ using UnityEngine.Pool;
9
+
10
+ /// <summary>
11
+ /// Helpers for creating UnityEngine.Pool object pools plus extensions that hydrate pooled items
12
+ /// through VContainer when you rent them via <see cref="GetWithRelations{T}(ObjectPool{T},IObjectResolver)"/>.
13
+ /// </summary>
14
+ public static class RelationalObjectPools
15
+ {
16
+ /// <summary>
17
+ /// Creates a component pool to be combined with <see cref="GetWithRelations{T}(ObjectPool{T},IObjectResolver)"/>
18
+ /// so items are injected and hydrated on rental time.
19
+ /// </summary>
20
+ public static ObjectPool<T> CreatePoolWithRelations<T>(
21
+ Func<T> createFunc,
22
+ Action<T> actionOnGet = null,
23
+ Action<T> actionOnRelease = null,
24
+ Action<T> actionOnDestroy = null,
25
+ bool collectionCheck = true,
26
+ int defaultCapacity = 10,
27
+ int maxSize = 10000
28
+ )
29
+ where T : Component
30
+ {
31
+ if (createFunc == null)
32
+ {
33
+ throw new ArgumentNullException(nameof(createFunc));
34
+ }
35
+
36
+ return new ObjectPool<T>(
37
+ createFunc,
38
+ actionOnGet: actionOnGet,
39
+ actionOnRelease: actionOnRelease,
40
+ actionOnDestroy: actionOnDestroy,
41
+ collectionCheck: collectionCheck,
42
+ defaultCapacity: defaultCapacity,
43
+ maxSize: maxSize
44
+ );
45
+ }
46
+
47
+ /// <summary>
48
+ /// Creates a GameObject pool to be combined with
49
+ /// <see cref="GetWithRelations(ObjectPool{GameObject},IObjectResolver)"/> so hierarchies are
50
+ /// injected and hydrated on rental time.
51
+ /// </summary>
52
+ public static ObjectPool<GameObject> CreateGameObjectPoolWithRelations(
53
+ GameObject prefab,
54
+ Transform parent = null,
55
+ Action<GameObject> actionOnGet = null,
56
+ Action<GameObject> actionOnRelease = null,
57
+ Action<GameObject> actionOnDestroy = null,
58
+ bool collectionCheck = true,
59
+ int defaultCapacity = 10,
60
+ int maxSize = 10000
61
+ )
62
+ {
63
+ if (prefab == null)
64
+ {
65
+ throw new ArgumentNullException(nameof(prefab));
66
+ }
67
+
68
+ Func<GameObject> create = () => UnityEngine.Object.Instantiate(prefab, parent);
69
+
70
+ return new ObjectPool<GameObject>(
71
+ create,
72
+ actionOnGet: actionOnGet,
73
+ actionOnRelease: actionOnRelease,
74
+ actionOnDestroy: actionOnDestroy,
75
+ collectionCheck: collectionCheck,
76
+ defaultCapacity: defaultCapacity,
77
+ maxSize: maxSize
78
+ );
79
+ }
80
+
81
+ /// <summary>
82
+ /// Rents an item from the pool, injects and assigns relational fields.
83
+ /// </summary>
84
+ public static T GetWithRelations<T>(this ObjectPool<T> pool, IObjectResolver resolver)
85
+ where T : Component
86
+ {
87
+ T item = pool.Get();
88
+ if (item != null)
89
+ {
90
+ resolver?.Inject(item);
91
+ resolver.AssignRelationalComponents(item);
92
+ }
93
+ return item;
94
+ }
95
+
96
+ /// <summary>
97
+ /// Rents a GameObject from the pool, injects the hierarchy and assigns relational fields.
98
+ /// </summary>
99
+ public static GameObject GetWithRelations(
100
+ this ObjectPool<GameObject> pool,
101
+ IObjectResolver resolver
102
+ )
103
+ {
104
+ GameObject go = pool.Get();
105
+ if (go != null)
106
+ {
107
+ resolver?.InjectGameObject(go);
108
+ resolver.AssignRelationalHierarchy(go, includeInactiveChildren: true);
109
+ }
110
+ return go;
111
+ }
112
+ }
113
+ }
114
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: fa576218812adfe4b98444f975a1cbf4
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -2,6 +2,7 @@
2
2
  namespace WallstopStudios.UnityHelpers.Integrations.VContainer
3
3
  {
4
4
  using System;
5
+ using WallstopStudios.UnityHelpers.Core.Helper;
5
6
 
6
7
  /// <summary>
7
8
  /// Controls how the VContainer integration applies relational component assignment.
@@ -24,25 +25,36 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
24
25
  /// When true the entry point will scan inactive scene objects so that relational fields are
25
26
  /// populated even for disabled hierarchies. Defaults to <c>true</c>.
26
27
  /// </param>
27
- public RelationalSceneAssignmentOptions(bool includeInactive)
28
+ /// <param name="useSinglePassScan">
29
+ /// When true uses a single-pass scene scan for performance (recommended). Defaults to
30
+ /// <c>true</c>.
31
+ /// </param>
32
+ public RelationalSceneAssignmentOptions(bool includeInactive, bool useSinglePassScan = true)
28
33
  {
29
34
  IncludeInactive = includeInactive;
35
+ UseSinglePassScan = useSinglePassScan;
30
36
  }
31
37
 
32
38
  /// <summary>
33
39
  /// Options used when no explicit configuration is supplied.
34
40
  /// </summary>
35
- public static RelationalSceneAssignmentOptions Default => new(includeInactive: true);
41
+ public static RelationalSceneAssignmentOptions Default => new(true, true);
36
42
 
37
43
  /// <summary>
38
44
  /// Gets whether inactive GameObjects should be included when scanning the scene.
39
45
  /// </summary>
40
46
  public bool IncludeInactive { get; }
41
47
 
48
+ /// <summary>
49
+ /// Gets whether to use a single-pass scene scan to locate relational components.
50
+ /// </summary>
51
+ public bool UseSinglePassScan { get; }
52
+
42
53
  /// <inheritdoc />
43
54
  public bool Equals(RelationalSceneAssignmentOptions other)
44
55
  {
45
- return IncludeInactive == other.IncludeInactive;
56
+ return IncludeInactive == other.IncludeInactive
57
+ && UseSinglePassScan == other.UseSinglePassScan;
46
58
  }
47
59
 
48
60
  /// <inheritdoc />
@@ -54,7 +66,7 @@ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
54
66
  /// <inheritdoc />
55
67
  public override int GetHashCode()
56
68
  {
57
- return IncludeInactive.GetHashCode();
69
+ return Objects.HashCode(IncludeInactive, UseSinglePassScan);
58
70
  }
59
71
 
60
72
  /// <summary>
@@ -0,0 +1,241 @@
1
+ #if VCONTAINER_PRESENT
2
+ namespace WallstopStudios.UnityHelpers.Integrations.VContainer
3
+ {
4
+ using System;
5
+ using System.Collections.Generic;
6
+ using global::VContainer.Unity;
7
+ using UnityEngine;
8
+ using UnityEngine.SceneManagement;
9
+ using WallstopStudios.UnityHelpers.Core.Attributes;
10
+ using WallstopStudios.UnityHelpers.Tags;
11
+ using WallstopStudios.UnityHelpers.Utils;
12
+
13
+ /// <summary>
14
+ /// Listens for additive scene loads and assigns relational fields for components in the
15
+ /// newly loaded scene using the configured options.
16
+ /// </summary>
17
+ public sealed class RelationalSceneLoadListener : IInitializable, IDisposable
18
+ {
19
+ private readonly IRelationalComponentAssigner _assigner;
20
+ private readonly AttributeMetadataCache _metadataCache;
21
+ private readonly RelationalSceneAssignmentOptions _options;
22
+
23
+ public RelationalSceneLoadListener(
24
+ IRelationalComponentAssigner assigner,
25
+ AttributeMetadataCache metadataCache,
26
+ RelationalSceneAssignmentOptions options
27
+ )
28
+ {
29
+ _assigner = assigner ?? throw new ArgumentNullException(nameof(assigner));
30
+ _metadataCache = metadataCache;
31
+ _options = options;
32
+ }
33
+
34
+ public void Initialize()
35
+ {
36
+ SceneManager.sceneLoaded += OnSceneLoaded;
37
+ }
38
+
39
+ public void Dispose()
40
+ {
41
+ SceneManager.sceneLoaded -= OnSceneLoaded;
42
+ }
43
+
44
+ internal void OnSceneLoaded(Scene scene, LoadSceneMode mode)
45
+ {
46
+ if (!scene.IsValid())
47
+ {
48
+ return;
49
+ }
50
+
51
+ AttributeMetadataCache cache = _metadataCache ?? AttributeMetadataCache.Instance;
52
+ if (cache == null)
53
+ {
54
+ return;
55
+ }
56
+
57
+ using PooledResource<List<Type>> pooledTypes = Buffers<Type>.List.Get(
58
+ out List<Type> relationalTypes
59
+ );
60
+ cache.CollectRelationalComponentTypes(relationalTypes);
61
+
62
+ bool includeInactive = _options.IncludeInactive;
63
+ if (relationalTypes.Count == 0)
64
+ {
65
+ // Fallback: scan all components once and assign when type has relational fields
66
+ Component[] all = includeInactive
67
+ ? UnityEngine.Object.FindObjectsOfType<Component>(true)
68
+ : UnityEngine.Object.FindObjectsOfType<Component>(false);
69
+
70
+ for (int i = 0; i < all.Length; i++)
71
+ {
72
+ Component c = all[i];
73
+ if (c == null || c.gameObject.scene != scene)
74
+ {
75
+ continue;
76
+ }
77
+
78
+ if (_assigner.HasRelationalAssignments(c.GetType()))
79
+ {
80
+ _assigner.Assign(c);
81
+ }
82
+ }
83
+ return;
84
+ }
85
+
86
+ if (_options.UseSinglePassScan)
87
+ {
88
+ AssignBySinglePass(scene, relationalTypes, includeInactive);
89
+ }
90
+ else
91
+ {
92
+ AssignByTypePass(scene, relationalTypes, includeInactive);
93
+ }
94
+
95
+ // Safety net in Editor/tests: walk scene roots to catch any missed components
96
+ #if UNITY_EDITOR
97
+ if (!Application.isPlaying)
98
+ {
99
+ AssignBySceneRoots(scene, includeInactive);
100
+
101
+ // In EditMode, object registration can lag a frame after scene creation.
102
+ // Schedule a follow-up pass to catch late-registered components.
103
+ UnityEditor.EditorApplication.delayCall += () =>
104
+ {
105
+ if (scene.IsValid())
106
+ {
107
+ AssignBySceneRoots(scene, includeInactive);
108
+ }
109
+ };
110
+ }
111
+ #endif
112
+ }
113
+
114
+ private void AssignByTypePass(
115
+ Scene target,
116
+ List<Type> relationalTypes,
117
+ bool includeInactive
118
+ )
119
+ {
120
+ using PooledResource<List<GameObject>> rootGoBuffer = Buffers<GameObject>.List.Get(
121
+ out List<GameObject> roots
122
+ );
123
+ target.GetRootGameObjects(roots);
124
+ if (roots.Count == 0)
125
+ {
126
+ return;
127
+ }
128
+
129
+ using PooledResource<HashSet<Type>> typeSetPool = Buffers<Type>.HashSet.Get(
130
+ out HashSet<Type> relationalSet
131
+ );
132
+ for (int i = 0; i < relationalTypes.Count; i++)
133
+ {
134
+ Type relationalType = relationalTypes[i];
135
+ if (relationalType != null)
136
+ {
137
+ relationalSet.Add(relationalType);
138
+ }
139
+ }
140
+
141
+ using PooledResource<List<Component>> componentBuffer = Buffers<Component>.List.Get(
142
+ out List<Component> components
143
+ );
144
+
145
+ for (int i = 0; i < roots.Count; i++)
146
+ {
147
+ GameObject root = roots[i];
148
+ if (root == null)
149
+ {
150
+ continue;
151
+ }
152
+
153
+ root.GetComponentsInChildren(includeInactive, components);
154
+ for (int j = 0; j < components.Count; j++)
155
+ {
156
+ Component component = components[j];
157
+ if (component == null || component.gameObject.scene != target)
158
+ {
159
+ continue;
160
+ }
161
+
162
+ Type current = component.GetType();
163
+ while (current != null && typeof(Component).IsAssignableFrom(current))
164
+ {
165
+ if (relationalSet.Contains(current))
166
+ {
167
+ _assigner.Assign(component);
168
+ break;
169
+ }
170
+ current = current.BaseType;
171
+ }
172
+ }
173
+
174
+ components.Clear();
175
+ }
176
+ }
177
+
178
+ private void AssignBySinglePass(
179
+ Scene target,
180
+ List<Type> relationalTypes,
181
+ bool includeInactive
182
+ )
183
+ {
184
+ using PooledResource<HashSet<Type>> pooledSet = Buffers<Type>.HashSet.Get(
185
+ out HashSet<Type> relationalSet
186
+ );
187
+ foreach (Type t in relationalTypes)
188
+ {
189
+ if (t != null)
190
+ {
191
+ relationalSet.Add(t);
192
+ }
193
+ }
194
+
195
+ Component[] all = includeInactive
196
+ ? UnityEngine.Object.FindObjectsOfType<Component>(true)
197
+ : UnityEngine.Object.FindObjectsOfType<Component>(false);
198
+
199
+ foreach (Component component in all)
200
+ {
201
+ if (component == null || component.gameObject.scene != target)
202
+ {
203
+ continue;
204
+ }
205
+
206
+ Type t = component.GetType();
207
+ while (t != null && typeof(Component).IsAssignableFrom(t))
208
+ {
209
+ if (relationalSet.Contains(t))
210
+ {
211
+ _assigner.Assign(component);
212
+ break;
213
+ }
214
+ t = t.BaseType;
215
+ }
216
+ }
217
+ }
218
+
219
+ private void AssignBySceneRoots(Scene target, bool includeInactive)
220
+ {
221
+ int rootCount = target.rootCount;
222
+ if (rootCount == 0)
223
+ {
224
+ return;
225
+ }
226
+ using PooledResource<List<GameObject>> rootGoBuffer = Buffers<GameObject>.List.Get(
227
+ out List<GameObject> roots
228
+ );
229
+ target.GetRootGameObjects(roots);
230
+ foreach (GameObject root in roots)
231
+ {
232
+ if (root == null)
233
+ {
234
+ continue;
235
+ }
236
+ _assigner.AssignHierarchy(root, includeInactive);
237
+ }
238
+ }
239
+ }
240
+ }
241
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9a9e90db7c71e6d448d94c973df2fb1b
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,9 @@
1
+ using System.Runtime.CompilerServices;
2
+
3
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Editor")]
4
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Runtime")]
5
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Editor")]
6
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Runtime.Zenject")]
7
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Runtime.VContainer")]
8
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Editor.VContainer")]
9
+ [assembly: InternalsVisibleTo("WallstopStudios.UnityHelpers.Tests.Editor.Zenject")]
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 8e6f7bff5ef44f688472b92382e2a9aa
3
+ timeCreated: 1760388364