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
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: ac9f163079562e14dbaaf3910614449c
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,337 @@
1
+ # Visual Components Guide
2
+
3
+ ## TL;DR — Why Use These
4
+
5
+ - **AnimatedSpriteLayer**: Data structure for packaging sprite animation frames with per-frame offsets and transparency
6
+ - **LayeredImage**: UI Toolkit element that composites multiple sprite animation layers into a single animated image
7
+ - **EnhancedImage**: Extended Unity UI Image with HDR color support and shape masking
8
+
9
+ These components solve the problem of creating complex, multi-layer sprite animations without pre-rendering every combination into massive sprite sheets.
10
+
11
+ ---
12
+
13
+ ## AnimatedSpriteLayer
14
+
15
+ **What it is:** An immutable data structure (struct) that packages a sprite animation sequence with per-frame position offsets and layer-wide alpha transparency.
16
+
17
+ **Why it exists:** When building complex sprite animations (like a character with equipment, effects, or layered body parts), you need a standardized way to represent each layer with its timing, positioning, and transparency. This struct is the building block for the LayeredImage composition system.
18
+
19
+ **Problem it solves:**
20
+
21
+ - Eliminates manually syncing sprite frames, offsets, and alpha values across multiple systems
22
+ - Provides type-safe storage for animation layer data
23
+ - Automatically converts world-space offsets to pixel-space for rendering
24
+ - Validates texture readability at construction time (catches import setting errors early)
25
+
26
+ ### When to Use
27
+
28
+ ✅ **Use when:**
29
+
30
+ - Building `LayeredImage` compositions
31
+ - Creating character animations with separate layers for body parts
32
+ - Combining sprite effects (glow, shadow, outline) with base sprites
33
+ - You need frame-by-frame position adjustments (bobbing, recoil, etc.)
34
+ - Working with sprite-based animations that need dynamic layering
35
+
36
+ ❌ **Don't use when:**
37
+
38
+ - You only have a single sprite sequence (just use `Animator`)
39
+ - Sprites don't need per-frame offsets (just use sprite arrays)
40
+ - You're working with UI Toolkit animations (use USS transitions)
41
+ - Performance is critical and you can pre-render combinations
42
+
43
+ ### Basic Usage
44
+
45
+ ```csharp
46
+ using WallstopStudios.UnityHelpers.Visuals;
47
+ using UnityEngine;
48
+
49
+ // Create a layer from sprite sequence
50
+ Sprite[] walkCycleFrames = LoadWalkCycleSprites(); // Must have Read/Write enabled!
51
+
52
+ // Optional: per-frame offsets in world space (e.g., for bobbing motion)
53
+ Vector2[] walkBobOffsets = new[]
54
+ {
55
+ new Vector2(0, 0.1f), // Frame 0: slight up
56
+ new Vector2(0, 0), // Frame 1: neutral
57
+ new Vector2(0, 0.1f), // Frame 2: slight up
58
+ new Vector2(0, 0) // Frame 3: neutral
59
+ };
60
+
61
+ AnimatedSpriteLayer bodyLayer = new AnimatedSpriteLayer(
62
+ sprites: walkCycleFrames,
63
+ worldSpaceOffsets: walkBobOffsets,
64
+ alpha: 1f // Fully opaque
65
+ );
66
+
67
+ // Create equipment layer (same frame count, different sprites)
68
+ Sprite[] helmetFrames = LoadHelmetSprites();
69
+ AnimatedSpriteLayer helmetLayer = new AnimatedSpriteLayer(
70
+ sprites: helmetFrames,
71
+ worldSpaceOffsets: null, // No offsets
72
+ alpha: 0.9f // Slightly transparent
73
+ );
74
+
75
+ // Combine in LayeredImage (see below)
76
+ ```
77
+
78
+ ### Editor-Only: Creating from AnimationClip
79
+
80
+ In editor code, you can create layers directly from AnimationClips:
81
+
82
+ ```csharp
83
+ #if UNITY_EDITOR
84
+ using UnityEditor;
85
+
86
+ AnimationClip walkClip = AssetDatabase.LoadAssetAtPath<AnimationClip>("Assets/Animations/Walk.anim");
87
+ AnimatedSpriteLayer layer = new AnimatedSpriteLayer(
88
+ clip: walkClip,
89
+ worldSpaceOffsets: null,
90
+ alpha: 1f
91
+ );
92
+ #endif
93
+ ```
94
+
95
+ ### Important Notes
96
+
97
+ **Texture Readability:**
98
+ All sprites must have **Read/Write Enabled** in their texture import settings. The constructor validates this and logs errors for non-readable textures.
99
+
100
+ To fix:
101
+
102
+ 1. Select the texture asset
103
+ 2. In Inspector, check "Read/Write Enabled"
104
+ 3. Click Apply
105
+
106
+ **Frame Rate:**
107
+ Default frame rate is 12 fps (stored in `AnimatedSpriteLayer.FrameRate` constant). This matches classic sprite animation timing.
108
+
109
+ **Offset Conversion:**
110
+ World-space offsets are automatically converted to pixel-space using sprite pixels-per-unit. This ensures offsets scale correctly with sprite resolution.
111
+
112
+ ---
113
+
114
+ ## LayeredImage
115
+
116
+ **What it is:** A UI Toolkit `VisualElement` that composites multiple `AnimatedSpriteLayer` instances into a single animated image with alpha blending, automatic cropping, and frame timing.
117
+
118
+ **Why it exists:** Creating character customization systems (body + equipment), visual effects (base + glow), or any multi-layer sprite animation traditionally requires pre-rendering every combination into massive sprite sheets. LayeredImage composes layers dynamically at runtime.
119
+
120
+ **Problem it solves:**
121
+
122
+ - **Sprite sheet explosion**: Instead of 10 bodies × 20 helmets × 15 armors = 3,000 pre-rendered sprites, you have 10 + 20 + 15 = 45 source sprites
123
+ - **Memory efficiency**: Only active layers are loaded, not every possible combination
124
+ - **Runtime flexibility**: Change equipment/effects without new assets
125
+ - **Automatic composition**: Handles alpha blending, pivot alignment, and cropping
126
+
127
+ ### When to Use
128
+
129
+ ✅ **Use when:**
130
+
131
+ - Character customization systems (swap equipment, clothing, accessories)
132
+ - Visual effects that layer over base sprites (shields, auras, damage flashes)
133
+ - Procedural sprite generation from components
134
+ - UI that needs animated, multi-layer sprites
135
+ - You want to avoid combinatorial explosion of pre-rendered sprites
136
+
137
+ ❌ **Don't use when:**
138
+
139
+ - Single-layer animations (use Unity's `Image` or `Animator`)
140
+ - 3D models (use skinned mesh renderers)
141
+ - Performance is absolutely critical and you can afford pre-rendered sheets
142
+ - Sprites don't share the same frame count/timing
143
+ - Working in UGUI (use `EnhancedImage` for UGUI, though it doesn't support layering)
144
+
145
+ ### Basic Usage
146
+
147
+ ```csharp
148
+ using WallstopStudios.UnityHelpers.Visuals.UIToolkit;
149
+ using UnityEngine.UIElements;
150
+
151
+ // Create layers (see AnimatedSpriteLayer section above)
152
+ AnimatedSpriteLayer[] layers = new[]
153
+ {
154
+ bodyLayer, // Base character
155
+ armorLayer, // Equipment layer 1
156
+ helmetLayer, // Equipment layer 2
157
+ glowLayer // Effect layer
158
+ };
159
+
160
+ // Create LayeredImage
161
+ LayeredImage characterImage = new LayeredImage(
162
+ inputSpriteLayers: layers,
163
+ backgroundColor: null, // Transparent background (or use Color for solid background)
164
+ fps: 12f, // Animation speed
165
+ updatesSelf: true, // Automatically advances frames (uses Unity editor ticks or coroutines)
166
+ pixelCutoff: 0.01f // Alpha threshold for cropping transparent pixels
167
+ );
168
+
169
+ // Add to UI Toolkit hierarchy
170
+ rootVisualElement.Add(characterImage);
171
+ ```
172
+
173
+ ### Manual Frame Control
174
+
175
+ If you need precise control over frame advancement:
176
+
177
+ ```csharp
178
+ LayeredImage manualImage = new LayeredImage(
179
+ inputSpriteLayers: layers,
180
+ backgroundColor: null,
181
+ fps: 12f,
182
+ updatesSelf: false, // Disable automatic updates
183
+ pixelCutoff: 0.01f
184
+ );
185
+
186
+ // In your update loop
187
+ void Update()
188
+ {
189
+ manualImage.Update(force: false); // Advances frame based on elapsed time
190
+ }
191
+
192
+ // Or force immediate frame advance
193
+ manualImage.Update(force: true);
194
+ ```
195
+
196
+ ### Changing Animation Speed
197
+
198
+ ```csharp
199
+ // Set frames per second at runtime
200
+ characterImage.Fps = 24f; // Speed up animation
201
+ characterImage.Fps = 6f; // Slow down animation
202
+ ```
203
+
204
+ ### How Compositing Works
205
+
206
+ LayeredImage performs these steps each frame:
207
+
208
+ 1. **Allocates canvas**: Creates a texture large enough to hold all layers with their offsets
209
+ 2. **Alpha blending**: Layers are composited back-to-front with alpha blending
210
+ 3. **Pivot alignment**: Each sprite's pivot point is respected during positioning
211
+ 4. **Offset application**: Per-frame pixel offsets are applied
212
+ 5. **Cropping**: Transparent borders are trimmed (configurable via `pixelCutoff`)
213
+ 6. **Rendering**: Final composited texture is displayed
214
+
215
+ **Performance optimization:**
216
+
217
+ - Uses parallel processing for large sprites (2048+ pixels total)
218
+ - Employs array pooling to minimize GC allocations
219
+ - Caches composited frames when possible
220
+
221
+ ### Pixel Cutoff Parameter
222
+
223
+ Controls how aggressive transparent pixel cropping is:
224
+
225
+ ```csharp
226
+ // More aggressive cropping (removes near-transparent pixels)
227
+ layeredImage.pixelCutoff = 0.05f;
228
+
229
+ // Less aggressive (keeps more semi-transparent pixels)
230
+ layeredImage.pixelCutoff = 0.001f;
231
+
232
+ // No cropping (includes fully transparent border)
233
+ layeredImage.pixelCutoff = 0f;
234
+ ```
235
+
236
+ Higher values = smaller final image, but may clip soft edges (glows, shadows).
237
+
238
+ ### Important Notes
239
+
240
+ **Frame Synchronization:**
241
+ All layers must have the same number of frames. Mixing 4-frame and 8-frame animations will cause visual glitches.
242
+
243
+ **Performance Considerations:**
244
+
245
+ - Compositing happens every frame for animated images
246
+ - Large sprite resolutions (1024×1024+) will impact performance
247
+ - Consider pre-rendering if targeting low-end devices
248
+ - Parallel processing threshold is 2048 pixels (width × height)
249
+
250
+ **Editor vs Runtime:**
251
+
252
+ - In Editor: Uses Unity's editor update ticks for animation
253
+ - In Runtime: Uses coroutines for frame timing
254
+ - Both honor `updatesSelf` setting
255
+
256
+ ---
257
+
258
+ ## EnhancedImage (UGUI)
259
+
260
+ **What it is:** An extended version of Unity's UI `Image` component with HDR color support and texture-based shape masking.
261
+
262
+ **Why it exists:** Unity's standard `Image` component doesn't support:
263
+
264
+ - HDR colors (for bloom/glow effects)
265
+ - Complex shape masks (beyond sprite masks)
266
+ - Shader-based shape rendering
267
+
268
+ **See full documentation:** [Editor Tools Guide - EnhancedImage](EDITOR_TOOLS_GUIDE.md#enhancedimage-editor)
269
+
270
+ **Quick example:**
271
+
272
+ ```csharp
273
+ using WallstopStudios.UnityHelpers.Visuals.UGUI;
274
+
275
+ EnhancedImage image = GetComponent<EnhancedImage>();
276
+
277
+ // HDR color for bloom
278
+ image.HdrColor = new Color(2f, 0.5f, 0.1f, 1f); // RGB values > 1 for bloom
279
+
280
+ // Shape mask
281
+ image.shapeMask = myMaskTexture; // Black areas are transparent
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Best Practices
287
+
288
+ ### AnimatedSpriteLayer
289
+
290
+ - **Always enable Read/Write** on source textures (build will fail otherwise)
291
+ - **Keep frame counts consistent** across layers for the same animation
292
+ - **Use world-space offsets** for consistent motion across different sprite resolutions
293
+ - **Cache layer instances** when using the same animation repeatedly (they're immutable)
294
+
295
+ ### LayeredImage
296
+
297
+ - **Layer order matters**: Layers are rendered front-to-back in array order
298
+ - **Optimize sprite sizes**: Trim transparent borders before importing (use Sprite Editor's "Tight" mode)
299
+ - **Profile on target hardware**: Mobile devices may struggle with 512×512+ composites at 60fps
300
+ - **Use manual updates** when syncing with non-UI systems (like gameplay state)
301
+ - **Pre-render** if combinations are limited and performance is critical
302
+
303
+ ### EnhancedImage
304
+
305
+ - **Don't mix with Image**: EnhancedImage replaces Unity's Image, don't use both
306
+ - **Material cleanup** is automatic but test in edit mode transitions
307
+ - **HDR requires post-processing**: Ensure Bloom is enabled in your camera's post-processing
308
+
309
+ ---
310
+
311
+ ## Related Documentation
312
+
313
+ - [Editor Tools Guide](EDITOR_TOOLS_GUIDE.md) - EnhancedImage editor integration
314
+ - [Samples](Samples~/) - Example projects for each component
315
+ - [Math & Extensions](MATH_AND_EXTENSIONS.md) - Color utilities used internally
316
+
317
+ ---
318
+
319
+ ## FAQ
320
+
321
+ **Q: Can I mix different frame counts in LayeredImage?**
322
+ A: No, all layers must have the same frame count. Pad shorter animations with duplicate frames if needed.
323
+
324
+ **Q: Why are my layers not aligned correctly?**
325
+ A: Check that sprite pivots are set correctly (usually center). LayeredImage respects sprite pivot points.
326
+
327
+ **Q: Can I change layers at runtime?**
328
+ A: Currently no, LayeredImage is immutable after construction. Create a new instance with updated layers.
329
+
330
+ **Q: Performance impact vs pre-rendered sprites?**
331
+ A: Compositing costs ~1-3ms per image on modern hardware. Pre-rendered is faster but uses more memory/storage.
332
+
333
+ **Q: Does this work with Unity's Animator?**
334
+ A: No, LayeredImage is independent. It's designed for UI Toolkit programmatic control.
335
+
336
+ **Q: Can I export the composited result?**
337
+ A: Not directly, but you could capture the rendered texture using `Texture2D.ReadPixels` in a render texture setup.
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: a5cbb14084a437b44a2dbf6d21d895f2
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant: