nccgs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/.claude/agents/nccgs-accessibility-specialist.md +26 -0
  2. package/.claude/agents/nccgs-adversarial-reviewer.md +26 -0
  3. package/.claude/agents/nccgs-ai-programmer.md +26 -0
  4. package/.claude/agents/nccgs-analytics-engineer.md +26 -0
  5. package/.claude/agents/nccgs-art-direction-lead.md +26 -0
  6. package/.claude/agents/nccgs-audio-direction-lead.md +26 -0
  7. package/.claude/agents/nccgs-creative-director.md +26 -0
  8. package/.claude/agents/nccgs-documentation-manager.md +26 -0
  9. package/.claude/agents/nccgs-economy-designer.md +26 -0
  10. package/.claude/agents/nccgs-engine-programmer.md +26 -0
  11. package/.claude/agents/nccgs-game-design-lead.md +26 -0
  12. package/.claude/agents/nccgs-game-designer.md +26 -0
  13. package/.claude/agents/nccgs-gameplay-programmer.md +26 -0
  14. package/.claude/agents/nccgs-level-designer.md +26 -0
  15. package/.claude/agents/nccgs-live-ops-designer.md +26 -0
  16. package/.claude/agents/nccgs-localization-lead.md +26 -0
  17. package/.claude/agents/nccgs-narrative-lead.md +26 -0
  18. package/.claude/agents/nccgs-network-programmer.md +26 -0
  19. package/.claude/agents/nccgs-performance-analyst.md +26 -0
  20. package/.claude/agents/nccgs-producer.md +26 -0
  21. package/.claude/agents/nccgs-production-coordinator.md +23 -0
  22. package/.claude/agents/nccgs-programming-lead.md +26 -0
  23. package/.claude/agents/nccgs-prototyper.md +26 -0
  24. package/.claude/agents/nccgs-qa-engineer.md +26 -0
  25. package/.claude/agents/nccgs-qa-lead.md +26 -0
  26. package/.claude/agents/nccgs-release-engineer.md +26 -0
  27. package/.claude/agents/nccgs-release-lead.md +26 -0
  28. package/.claude/agents/nccgs-security-engineer.md +26 -0
  29. package/.claude/agents/nccgs-sound-designer.md +26 -0
  30. package/.claude/agents/nccgs-systems-designer.md +26 -0
  31. package/.claude/agents/nccgs-technical-architect.md +26 -0
  32. package/.claude/agents/nccgs-technical-artist.md +26 -0
  33. package/.claude/agents/nccgs-technical-director.md +26 -0
  34. package/.claude/agents/nccgs-tools-programmer.md +26 -0
  35. package/.claude/agents/nccgs-ui-programmer.md +26 -0
  36. package/.claude/agents/nccgs-unity-build-specialist.md +26 -0
  37. package/.claude/agents/nccgs-unity-content-specialist.md +26 -0
  38. package/.claude/agents/nccgs-unity-implementer.md +26 -0
  39. package/.claude/agents/nccgs-unity-rendering-specialist.md +26 -0
  40. package/.claude/agents/nccgs-unity-systems-specialist.md +26 -0
  41. package/.claude/agents/nccgs-unity-ui-specialist.md +26 -0
  42. package/.claude/agents/nccgs-ux-designer.md +26 -0
  43. package/.claude/agents/nccgs-verification-engineer.md +26 -0
  44. package/.claude/agents/nccgs-world-builder.md +26 -0
  45. package/.claude/agents/nccgs-writer.md +26 -0
  46. package/.claude/nccgs/THIRD_PARTY_NOTICES.md +13 -0
  47. package/.claude/nccgs/VERSION +1 -0
  48. package/.claude/nccgs/constitution.md +131 -0
  49. package/.claude/nccgs/hooks/agent-audit.mjs +10 -0
  50. package/.claude/nccgs/hooks/common.mjs +41 -0
  51. package/.claude/nccgs/hooks/post-compact.mjs +1 -0
  52. package/.claude/nccgs/hooks/pre-compact.mjs +8 -0
  53. package/.claude/nccgs/hooks/protect-git.mjs +22 -0
  54. package/.claude/nccgs/hooks/protect-write.mjs +17 -0
  55. package/.claude/nccgs/hooks/session-start.mjs +15 -0
  56. package/.claude/nccgs/hooks/session-stop.mjs +7 -0
  57. package/.claude/nccgs/protocols/agent-contract.md +34 -0
  58. package/.claude/nccgs/protocols/context-packets.md +13 -0
  59. package/.claude/nccgs/protocols/evidence.md +15 -0
  60. package/.claude/nccgs/protocols/model-routing.md +22 -0
  61. package/.claude/nccgs/protocols/orchestration.md +26 -0
  62. package/.claude/nccgs/protocols/unity-boundary.md +11 -0
  63. package/.claude/nccgs/settings.fragment.json +77 -0
  64. package/.claude/nccgs/studio.json +347 -0
  65. package/.claude/nccgs/tools/configure-models.mjs +39 -0
  66. package/.claude/nccgs/unity-skills-manifest.json +727 -0
  67. package/.claude/nccgs/workflow-catalog.json +317 -0
  68. package/.claude/rules/nccgs-canonical-docs.md +19 -0
  69. package/.claude/rules/nccgs-editor-tools.md +12 -0
  70. package/.claude/rules/nccgs-localization.md +12 -0
  71. package/.claude/rules/nccgs-networking.md +13 -0
  72. package/.claude/rules/nccgs-performance.md +14 -0
  73. package/.claude/rules/nccgs-rendering.md +16 -0
  74. package/.claude/rules/nccgs-security.md +13 -0
  75. package/.claude/rules/nccgs-tests.md +18 -0
  76. package/.claude/rules/nccgs-ui.md +14 -0
  77. package/.claude/rules/nccgs-unity-assets.md +21 -0
  78. package/.claude/rules/nccgs-unity-code.md +22 -0
  79. package/.claude/skills/accessibility-review/SKILL.md +14 -0
  80. package/.claude/skills/architecture-decision/SKILL.md +14 -0
  81. package/.claude/skills/asset-audit/SKILL.md +14 -0
  82. package/.claude/skills/audit/SKILL.md +16 -0
  83. package/.claude/skills/audit/references/dimensions.md +46 -0
  84. package/.claude/skills/balance-review/SKILL.md +14 -0
  85. package/.claude/skills/bug-triage/SKILL.md +14 -0
  86. package/.claude/skills/build-live-game/SKILL.md +317 -0
  87. package/.claude/skills/build-live-game/references/achievements.md +779 -0
  88. package/.claude/skills/build-live-game/references/apis.md +280 -0
  89. package/.claude/skills/build-live-game/references/authentication.md +437 -0
  90. package/.claude/skills/build-live-game/references/battlepass.md +860 -0
  91. package/.claude/skills/build-live-game/references/cloud-code.md +563 -0
  92. package/.claude/skills/build-live-game/references/cloud-save.md +474 -0
  93. package/.claude/skills/build-live-game/references/deployment.md +216 -0
  94. package/.claude/skills/build-live-game/references/player-account.md +813 -0
  95. package/.claude/skills/build-live-game/references/remote-config.md +96 -0
  96. package/.claude/skills/build-live-game/references/tooling.md +431 -0
  97. package/.claude/skills/closure/SKILL.md +14 -0
  98. package/.claude/skills/code-review/SKILL.md +14 -0
  99. package/.claude/skills/compatibility-review/SKILL.md +14 -0
  100. package/.claude/skills/context-pack/SKILL.md +14 -0
  101. package/.claude/skills/dependency-review/SKILL.md +14 -0
  102. package/.claude/skills/design/SKILL.md +20 -0
  103. package/.claude/skills/design-review/SKILL.md +14 -0
  104. package/.claude/skills/evidence-review/SKILL.md +14 -0
  105. package/.claude/skills/hotfix/SKILL.md +14 -0
  106. package/.claude/skills/implement-in-app-purchases/README.md +233 -0
  107. package/.claude/skills/implement-in-app-purchases/SKILL.md +158 -0
  108. package/.claude/skills/implement-in-app-purchases/references/api-notes.md +562 -0
  109. package/.claude/skills/implement-in-app-purchases/references/codeless-catalog.md +331 -0
  110. package/.claude/skills/implement-in-app-purchases/references/convert-adapty.md +268 -0
  111. package/.claude/skills/implement-in-app-purchases/references/convert-essentialkit.md +239 -0
  112. package/.claude/skills/implement-in-app-purchases/references/convert-revenuecat.md +275 -0
  113. package/.claude/skills/implement-in-app-purchases/references/convert-unipay.md +145 -0
  114. package/.claude/skills/implement-in-app-purchases/references/migration-v4-to-v5.md +204 -0
  115. package/.claude/skills/implement-in-app-purchases/references/path-add-iap-to-new-project.md +198 -0
  116. package/.claude/skills/implement-in-app-purchases/references/path-convert-native-google-billing.md +356 -0
  117. package/.claude/skills/implement-in-app-purchases/references/path-convert-native-storekit.md +446 -0
  118. package/.claude/skills/implement-in-app-purchases/references/path-implement-iap-d2c.md +680 -0
  119. package/.claude/skills/implement-in-app-purchases/references/platform-notes.md +204 -0
  120. package/.claude/skills/implement-in-app-purchases/references/pre-check.md +205 -0
  121. package/.claude/skills/incident-recovery/SKILL.md +14 -0
  122. package/.claude/skills/initialize-ai-navigation/SKILL.md +95 -0
  123. package/.claude/skills/initialize-ai-navigation/references/navigation-system.md +794 -0
  124. package/.claude/skills/levelplay-unity-integration/CHANGELOG.md +57 -0
  125. package/.claude/skills/levelplay-unity-integration/README.md +74 -0
  126. package/.claude/skills/levelplay-unity-integration/SKILL.md +1126 -0
  127. package/.claude/skills/levelplay-unity-integration/references/banner-api.md +920 -0
  128. package/.claude/skills/levelplay-unity-integration/references/best-practices.md +536 -0
  129. package/.claude/skills/levelplay-unity-integration/references/ilrd-api.md +337 -0
  130. package/.claude/skills/levelplay-unity-integration/references/initialization-api.md +630 -0
  131. package/.claude/skills/levelplay-unity-integration/references/interstitial-api.md +899 -0
  132. package/.claude/skills/levelplay-unity-integration/references/ios-setup.md +491 -0
  133. package/.claude/skills/levelplay-unity-integration/references/migration-sdk-9.md +666 -0
  134. package/.claude/skills/levelplay-unity-integration/references/privacy-settings.md +608 -0
  135. package/.claude/skills/levelplay-unity-integration/references/rewarded-api.md +902 -0
  136. package/.claude/skills/localization/SKILL.md +135 -0
  137. package/.claude/skills/localization/references/api-notes.md +76 -0
  138. package/.claude/skills/localization/resources/L10nBatchProcessor.cs +69 -0
  139. package/.claude/skills/localization/resources/LocalizedFontAsset.cs +18 -0
  140. package/.claude/skills/localize-game/SKILL.md +14 -0
  141. package/.claude/skills/migrate-project/SKILL.md +21 -0
  142. package/.claude/skills/migrate-project/references/procedure.md +63 -0
  143. package/.claude/skills/milestone-review/SKILL.md +14 -0
  144. package/.claude/skills/new-unity-project/SKILL.md +179 -0
  145. package/.claude/skills/optimize-audio/SKILL.md +199 -0
  146. package/.claude/skills/optimize-audio/resources/audio-import-api.md +146 -0
  147. package/.claude/skills/optimize-audio/resources/platform-settings.md +48 -0
  148. package/.claude/skills/optimize-text-mesh-pro/SKILL.md +182 -0
  149. package/.claude/skills/optimize-web/SKILL.md +393 -0
  150. package/.claude/skills/optimize-web/resources/WebOptimizer.cs +21 -0
  151. package/.claude/skills/optimize-web/resources/toktx-examples.sh +11 -0
  152. package/.claude/skills/performance-audit/SKILL.md +14 -0
  153. package/.claude/skills/physics-3d-collision/SKILL.md +442 -0
  154. package/.claude/skills/physics-3d-collision/references/troubleshooting.md +41 -0
  155. package/.claude/skills/physics-3d-collision/resources/CollisionDebugger.cs +33 -0
  156. package/.claude/skills/plan-feature/SKILL.md +14 -0
  157. package/.claude/skills/playtest/SKILL.md +14 -0
  158. package/.claude/skills/project-stage/SKILL.md +14 -0
  159. package/.claude/skills/prototype-feature/SKILL.md +14 -0
  160. package/.claude/skills/qa-plan/SKILL.md +14 -0
  161. package/.claude/skills/release/SKILL.md +18 -0
  162. package/.claude/skills/release-readiness/SKILL.md +14 -0
  163. package/.claude/skills/retrospective/SKILL.md +14 -0
  164. package/.claude/skills/review/SKILL.md +16 -0
  165. package/.claude/skills/security-audit/SKILL.md +14 -0
  166. package/.claude/skills/setup-multiplayer-services/SKILL.md +39 -0
  167. package/.claude/skills/setup-multiplayer-services/references/dgs-entrypoint.md +79 -0
  168. package/.claude/skills/setup-multiplayer-services/references/entrypoints.md +213 -0
  169. package/.claude/skills/setup-multiplayer-services/references/examples.md +33 -0
  170. package/.claude/skills/setup-multiplayer-services/references/implementation-fit.md +30 -0
  171. package/.claude/skills/setup-multiplayer-services/references/underlying-services.md +11 -0
  172. package/.claude/skills/setup-multiplayer-services/references/workflows-prerequisites.md +17 -0
  173. package/.claude/skills/setup-vivox-voice-chat/SKILL.md +118 -0
  174. package/.claude/skills/setup-vivox-voice-chat/evals/.env.example +6 -0
  175. package/.claude/skills/setup-vivox-voice-chat/evals/README.md +101 -0
  176. package/.claude/skills/setup-vivox-voice-chat/evals/promptfooconfig.yaml +32 -0
  177. package/.claude/skills/setup-vivox-voice-chat/evals/tests/init-and-login.yaml +76 -0
  178. package/.claude/skills/setup-vivox-voice-chat/evals/tests/text-chat.yaml +65 -0
  179. package/.claude/skills/setup-vivox-voice-chat/evals/tests/voice-channels.yaml +74 -0
  180. package/.claude/skills/setup-vivox-voice-chat/references/events-and-participants.md +79 -0
  181. package/.claude/skills/setup-vivox-voice-chat/references/init-and-login.md +92 -0
  182. package/.claude/skills/setup-vivox-voice-chat/references/text-chat.md +93 -0
  183. package/.claude/skills/setup-vivox-voice-chat/references/troubleshooting.md +47 -0
  184. package/.claude/skills/setup-vivox-voice-chat/references/voice-channels.md +90 -0
  185. package/.claude/skills/shader-graph-create-custom-node/SKILL.md +25 -0
  186. package/.claude/skills/shader-graph-create-custom-node/resources/all_hints.hlsl +182 -0
  187. package/.claude/skills/sprint-plan/SKILL.md +14 -0
  188. package/.claude/skills/sprite-editor/SKILL.md +66 -0
  189. package/.claude/skills/sprite-editor/references/api_reference.md +151 -0
  190. package/.claude/skills/sprite-editor/references/background.md +112 -0
  191. package/.claude/skills/sprite-editor/references/templates.md +72 -0
  192. package/.claude/skills/sprite-editor/scripts/AutomaticSliceTexture.cs +40 -0
  193. package/.claude/skills/sprite-editor/scripts/GenerateNewSpriteRects.cs +200 -0
  194. package/.claude/skills/sprite-editor/scripts/GetTextureSourceImageSize.cs +32 -0
  195. package/.claude/skills/sprite-editor/scripts/GetTextureToSlice.cs +55 -0
  196. package/.claude/skills/sprite-editor/scripts/GridSliceTexture.cs +40 -0
  197. package/.claude/skills/sprite-editor/scripts/IsometricSliceTexture.cs +141 -0
  198. package/.claude/skills/sprite-editor/scripts/README.md +134 -0
  199. package/.claude/skills/sprite-editor/scripts/SetPivotExample.cs +58 -0
  200. package/.claude/skills/sprite-editor/scripts/SpriteToPng.cs +88 -0
  201. package/.claude/skills/status/SKILL.md +16 -0
  202. package/.claude/skills/story-readiness/SKILL.md +14 -0
  203. package/.claude/skills/test/SKILL.md +16 -0
  204. package/.claude/skills/ui/SKILL.md +142 -0
  205. package/.claude/skills/ui-imgui/SKILL.md +186 -0
  206. package/.claude/skills/ui-imgui/references/gui-elements.md +156 -0
  207. package/.claude/skills/ui-imgui/references/templates.md +141 -0
  208. package/.claude/skills/ui-review/SKILL.md +14 -0
  209. package/.claude/skills/ui-ugui/SKILL.md +282 -0
  210. package/.claude/skills/ui-ugui/references/scrollview-setup.md +29 -0
  211. package/.claude/skills/ui-uitk/SKILL.md +235 -0
  212. package/.claude/skills/ui-uitk/references/common-issues.md +74 -0
  213. package/.claude/skills/ui-uitk/references/custom-elements.md +241 -0
  214. package/.claude/skills/ui-uitk/references/painter2d.md +282 -0
  215. package/.claude/skills/ui-uitk/references/pointermanipulator-guide.md +94 -0
  216. package/.claude/skills/ui-uitk/references/svg-icons.md +136 -0
  217. package/.claude/skills/ui-uitk/references/ui-runtime-binding.md +234 -0
  218. package/.claude/skills/ui-uitk/references/uss-guide.md +138 -0
  219. package/.claude/skills/unity-cli/CHANGELOG.md +233 -0
  220. package/.claude/skills/unity-cli/SECURITY.md +22 -0
  221. package/.claude/skills/unity-cli/SKILL.md +414 -0
  222. package/.claude/skills/unity-cli/references/auth-license-cloud.md +146 -0
  223. package/.claude/skills/unity-cli/references/build-run-test.md +349 -0
  224. package/.claude/skills/unity-cli/references/collaboration.md +472 -0
  225. package/.claude/skills/unity-cli/references/config-hub.md +103 -0
  226. package/.claude/skills/unity-cli/references/diagnostics-maintenance.md +326 -0
  227. package/.claude/skills/unity-cli/references/editors-install.md +327 -0
  228. package/.claude/skills/unity-cli/references/integration-advanced.md +472 -0
  229. package/.claude/skills/unity-cli/references/projects-templates.md +574 -0
  230. package/.claude/skills/unity-package-management/SKILL.md +304 -0
  231. package/.claude/skills/unity-package-management/references/select-packages.md +108 -0
  232. package/.claude/skills/urp-postprocessing/SKILL.md +188 -0
  233. package/.claude/skills/urp-postprocessing/references/code-templates.md +119 -0
  234. package/.claude/skills/urp-postprocessing/references/effect-reference.md +86 -0
  235. package/.claude/skills/validate-urp-render-graph-renderer-feature/SKILL.md +269 -0
  236. package/.claude/skills/work/SKILL.md +36 -0
  237. package/.claude/skills/work/references/classification.md +41 -0
  238. package/.claude/skills/work/references/closure.md +50 -0
  239. package/.claude/skills/work/references/feature-contracts.md +32 -0
  240. package/.claude/skills/work/references/verification.md +26 -0
  241. package/CLAUDE.md +6 -0
  242. package/LICENSE +21 -0
  243. package/README.md +162 -0
  244. package/THIRD_PARTY_NOTICES.md +23 -0
  245. package/UPGRADING.md +32 -0
  246. package/VERSION +1 -0
  247. package/docs/ARCHITECTURE.md +73 -0
  248. package/docs/HUONG-DAN-MIGRATE-VA-SU-DUNG.md +324 -0
  249. package/docs/MIGRATION-MATRIX.md +23 -0
  250. package/docs/PROJECT-POLICY.md +67 -0
  251. package/docs/WORKFLOWS.md +61 -0
  252. package/package-assets/setup-vivox-voice-chat-evals.gitignore +7 -0
  253. package/package.json +41 -0
  254. package/scaffold/.nccgs/bugs/.gitkeep +1 -0
  255. package/scaffold/.nccgs/closures/.gitkeep +1 -0
  256. package/scaffold/.nccgs/context/.gitkeep +1 -0
  257. package/scaffold/.nccgs/decisions/.gitkeep +1 -0
  258. package/scaffold/.nccgs/evidence/.gitkeep +1 -0
  259. package/scaffold/.nccgs/features/.gitkeep +1 -0
  260. package/scaffold/.nccgs/migrations/.gitkeep +1 -0
  261. package/scaffold/.nccgs/playtests/.gitkeep +1 -0
  262. package/scaffold/.nccgs/project.yaml +103 -0
  263. package/scaffold/.nccgs/requirements.yaml +10 -0
  264. package/scaffold/.nccgs/reviews/.gitkeep +1 -0
  265. package/scaffold/.nccgs/state.md +40 -0
  266. package/scaffold/.nccgs/templates/agent-handoff.md +25 -0
  267. package/scaffold/.nccgs/templates/architecture-decision.md +27 -0
  268. package/scaffold/.nccgs/templates/closure-record.md +51 -0
  269. package/scaffold/.nccgs/templates/context-packet.yaml +17 -0
  270. package/scaffold/.nccgs/templates/evidence-record.md +23 -0
  271. package/scaffold/.nccgs/templates/feature-contract.md +35 -0
  272. package/scaffold/.nccgs/templates/migration-plan.md +40 -0
  273. package/scaffold/.nccgs/templates/waiver.md +11 -0
  274. package/scripts/cli.mjs +56 -0
  275. package/scripts/install.mjs +267 -0
  276. package/scripts/sync-unity-skills.mjs +126 -0
  277. package/scripts/validate.mjs +205 -0
  278. package/tests/framework.test.mjs +121 -0
@@ -0,0 +1,134 @@
1
+ # Sprite Editor Utility Examples
2
+
3
+ Reference implementations demonstrating sprite editing operations. Each file contains a single method for token efficiency.
4
+
5
+ ## Basic Operations
6
+
7
+ ### GetTextureSourceImageSize.cs
8
+ Gets the original source image dimensions (before import).
9
+
10
+ **Use when:** You need to know the true image dimensions, not the imported texture size.
11
+
12
+ **Key APIs:** ITextureDataProvider.GetTextureActualWidthAndHeight()
13
+
14
+ ### SpriteToPng.cs
15
+ Exports a sprite to PNG byte array by rendering its mesh geometry.
16
+
17
+ **Use when:** Extracting individual sprites from sprite sheets.
18
+
19
+ **Key concepts:** Renders sprite vertices, UVs, and triangles. Handles tight packing and custom meshes.
20
+
21
+ ### SetPivotExample.cs
22
+ Demonstrates setting sprite pivots using both predefined alignments and custom pivot positions.
23
+
24
+ **Use when:** Changing sprite pivot points.
25
+
26
+ **Key methods:**
27
+ - `SpriteEditorUtility.SetCustomPivot()` - Sets custom pivot position. Must set `alignment = SpriteAlignment.Custom` and `pivot = Vector2`
28
+ - `SpriteEditorUtility.SetPivot()` - Sets predefined alignment (Center, BottomLeft, TopRight, etc.)
29
+
30
+ **Important:** Always set `alignment` field when changing pivots. Custom pivots require `SpriteAlignment.Custom`.
31
+
32
+ ## Slicing Operations
33
+
34
+ ### GetTextureToSlice.cs
35
+ Prepares a readable texture for slicing, upscaling to original dimensions if needed.
36
+
37
+ **Use when:** Before any slicing operation to ensure correct coordinates.
38
+
39
+ **Key concept:** See [../references/background.md](../references/background.md#critical-for-slicing-operations) for why this is necessary.
40
+
41
+ ### AutomaticSliceTexture.cs
42
+ Automatically detects sprite regions using Unity's built-in detection algorithm.
43
+
44
+ **Use when:** Slicing sprite sheets where sprites have transparent borders.
45
+
46
+ **Key APIs:**
47
+ - UnityEditorInternal.InternalSpriteUtility.GenerateAutomaticSpriteRectangles()
48
+ - GenerateNewSpriteRects() for sprite management
49
+
50
+ ### GridSliceTexture.cs
51
+ Slices textures into regular grid patterns.
52
+
53
+ **Use when:** Sprite sheet has evenly-spaced sprites (e.g., animation frames, tile sets).
54
+
55
+ **Parameters:** offset, size, padding, keepEmptyRects
56
+
57
+ **Key APIs:** UnityEditorInternal.InternalSpriteUtility.GenerateGridSpriteRectangles()
58
+
59
+ ### IsometricSliceTexture.cs
60
+ Slices textures into isometric diamond-pattern tiles.
61
+
62
+ **Use when:** Working with isometric tile sets (e.g., isometric RPG tiles).
63
+
64
+ **Key features:**
65
+ - Diamond-shaped outline generation
66
+ - Empty tile detection based on alpha pixels
67
+ - Alternating row offset support
68
+
69
+ **Key APIs:** ISpriteOutlineDataProvider for diamond outlines
70
+
71
+ ### GenerateNewSpriteRects.cs
72
+ Core utility for managing sprite rectangles during slicing operations.
73
+
74
+ **Three modes:**
75
+ - **DeleteAll**: Replace all existing sprites with new ones
76
+ - **Smart**: Update overlapping sprites, add non-overlapping ones
77
+ - **Safe**: Only add sprites that don't overlap with existing sprites
78
+
79
+ **Key features:**
80
+ - Automatic sprite naming with conflict resolution
81
+ - Overlap detection (with tolerance and best-fit options)
82
+ - Preserves existing sprites in Safe/Smart modes
83
+
84
+ **Use when:** Implementing custom slicing logic or managing sprite updates.
85
+
86
+ ## Usage Pattern
87
+
88
+ All slicing utilities follow this pattern:
89
+
90
+ ```csharp
91
+ // 1. Get texture at original size
92
+ var texture = GetTextureToSlice(textureProvider);
93
+
94
+ // 2. Generate rectangles
95
+ var rects = [algorithm to generate Rect collection];
96
+
97
+ // 3. Convert to SpriteRects with management logic
98
+ var newRects = GenerateNewSpriteRects(
99
+ spriteDataProvider,
100
+ rects,
101
+ addNewSpriteMethod,
102
+ nameGenerator
103
+ );
104
+
105
+ // 4. Apply to data provider
106
+ spriteDataProvider.SetSpriteRects(newRects.ToArray());
107
+ ```
108
+
109
+ ## Name Generator Examples
110
+
111
+ The `nameGenerator` parameter is a function that takes an integer index and returns a sprite name string.
112
+
113
+ ### Using Asset Filename from Data Provider
114
+ ```csharp
115
+ string assetPath = AssetDatabase.GetAssetPath(spriteDataProvider.targetObject);
116
+ string filename = !string.IsNullOrEmpty(assetPath)
117
+ ? System.IO.Path.GetFileNameWithoutExtension(assetPath)
118
+ : "sprite";
119
+ Func<int, string> nameGenerator = (index) => $"{filename}_{index}";
120
+ // Produces: character_sheet_0, character_sheet_1, etc. (or sprite_0, sprite_1 if no path)
121
+ ```
122
+
123
+ ### Simple Numbered Names
124
+ ```csharp
125
+ Func<int, string> nameGenerator = (index) => $"sprite_{index}";
126
+ // Produces: sprite_0, sprite_1, sprite_2, etc.
127
+ ```
128
+
129
+ ## Important Notes
130
+
131
+ - All coordinates are in **original image space** (see [../references/background.md](../references/background.md#original-vs-imported-image-sizes))
132
+ - Use GetTextureToSlice before any slicing operation
133
+ - GenerateNewSpriteRects handles name conflicts and overlap detection
134
+ - For Unity 2021.2+ requirements, see [../references/background.md](../references/background.md#version-specific-requirements)
@@ -0,0 +1,58 @@
1
+ using UnityEditor;
2
+ using UnityEditor.U2D.Sprites;
3
+ using UnityEngine;
4
+
5
+ namespace Editor
6
+ {
7
+ static public partial class SpriteEditorUtility
8
+ {
9
+ /// <summary>
10
+ /// Sets a custom pivot point for a specific sprite within a sprite editor data provider.
11
+ /// The pivot is specified as a normalized Vector2 where (0,0) is bottom-left and (1,1) is top-right.
12
+ /// </summary>
13
+ /// <param name="dataProvider">The sprite editor data provider containing the sprite data.</param>
14
+ /// <param name="sprite">The GUID of the sprite to modify.</param>
15
+ /// <param name="pivot">The normalized pivot position (0-1 range for both x and y).</param>
16
+ /// <returns>True if the sprite was found and the pivot was set successfully; otherwise, false.</returns>
17
+ public static bool SetCustomPivot(ISpriteEditorDataProvider dataProvider, GUID sprite, Vector2 pivot)
18
+ {
19
+ var rects = dataProvider.GetSpriteRects();
20
+ for (int i = 0; i < rects.Length; ++i)
21
+ {
22
+ if (rects[i].spriteID == sprite)
23
+ {
24
+ rects[i].pivot = pivot;
25
+ rects[i].alignment = SpriteAlignment.Custom;
26
+ dataProvider.SetSpriteRects(rects);
27
+ return true;
28
+ }
29
+ }
30
+
31
+ return false;
32
+ }
33
+
34
+ /// <summary>
35
+ /// Sets a predefined pivot alignment for a specific sprite within a sprite editor data provider.
36
+ /// Uses Unity's built-in alignment options (e.g., Center, TopLeft, BottomRight).
37
+ /// </summary>
38
+ /// <param name="dataProvider">The sprite editor data provider containing the sprite data.</param>
39
+ /// <param name="sprite">The GUID of the sprite to modify.</param>
40
+ /// <param name="alignment">The predefined sprite alignment to apply.</param>
41
+ /// <returns>True if the sprite was found and the alignment was set successfully; otherwise, false.</returns>
42
+ public static bool SetPivot(ISpriteEditorDataProvider dataProvider, GUID sprite, SpriteAlignment alignment)
43
+ {
44
+ var rects = dataProvider.GetSpriteRects();
45
+ for (int i = 0; i < rects.Length; ++i)
46
+ {
47
+ if (rects[i].spriteID == sprite)
48
+ {
49
+ rects[i].alignment = alignment;
50
+ dataProvider.SetSpriteRects(rects);
51
+ return true;
52
+ }
53
+ }
54
+
55
+ return false;
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,88 @@
1
+ using UnityEditor;
2
+ using UnityEngine;
3
+
4
+ namespace Editor
5
+ {
6
+ static public partial class SpriteEditorUtility
7
+ {
8
+ static public byte[] SpriteToPng(Sprite sprite)
9
+ {
10
+ Texture2D texture = sprite.texture;
11
+ Rect rect = sprite.textureRect;
12
+
13
+ // Create a temporary RenderTexture
14
+ RenderTexture renderTexture = RenderTexture.GetTemporary(
15
+ (int)rect.width,
16
+ (int)rect.height,
17
+ 0,
18
+ RenderTextureFormat.ARGB32,
19
+ RenderTextureReadWrite.Default);
20
+
21
+ // Save the current active RenderTexture
22
+ RenderTexture previousActive = RenderTexture.active;
23
+ RenderTexture.active = renderTexture;
24
+
25
+ GL.Clear(true, true, Color.clear);
26
+
27
+ // Get sprite vertices and UVs
28
+ Vector2[] vertices = sprite.vertices;
29
+ Vector2[] uvs = sprite.uv;
30
+ ushort[] triangles = sprite.triangles;
31
+
32
+ // Calculate bounds for centering
33
+ Vector2 min = new Vector2(float.MaxValue, float.MaxValue);
34
+ Vector2 max = new Vector2(float.MinValue, float.MinValue);
35
+ foreach (var v in vertices)
36
+ {
37
+ min = Vector2.Min(min, v);
38
+ max = Vector2.Max(max, v);
39
+ }
40
+
41
+ Vector2 size = max - min;
42
+ Vector2 offset = -min;
43
+
44
+ // Create material for rendering the sprite with proper alpha
45
+ Material mat = new Material(Shader.Find("UI/Default"));
46
+ mat.mainTexture = texture;
47
+
48
+ // Render the sprite mesh
49
+ GL.PushMatrix();
50
+ GL.LoadPixelMatrix(0, rect.width, 0, rect.height);
51
+
52
+ mat.SetPass(0);
53
+ GL.Begin(GL.TRIANGLES);
54
+
55
+ for (int i = 0; i < triangles.Length; i += 3)
56
+ {
57
+ for (int j = 0; j < 3; j++)
58
+ {
59
+ int idx = triangles[i + j];
60
+ Vector2 vertex = vertices[idx];
61
+ Vector2 uv = uvs[idx];
62
+
63
+ // Transform vertex to render texture space
64
+ float x = (vertex.x + offset.x) * rect.width / size.x;
65
+ float y = (vertex.y + offset.y) * rect.height / size.y;
66
+
67
+ GL.TexCoord2(uv.x, uv.y);
68
+ GL.Vertex3(x, y, 0);
69
+ }
70
+ }
71
+
72
+ GL.End();
73
+ GL.PopMatrix();
74
+
75
+ // Read pixels from RenderTexture into a new Texture2D
76
+ Texture2D croppedTexture = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.ARGB32, false);
77
+ croppedTexture.ReadPixels(new Rect(0, 0, rect.width, rect.height), 0, 0);
78
+ croppedTexture.Apply();
79
+
80
+ // Restore the previous RenderTexture and clean up
81
+ RenderTexture.active = previousActive;
82
+ RenderTexture.ReleaseTemporary(renderTexture);
83
+ Object.DestroyImmediate(mat);
84
+
85
+ return croppedTexture.EncodeToPNG();
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: status
3
+ description: Reports read-only NCCGS project status including active work, risk, selected roles/models, context freshness, evidence, blockers, closure artifacts, repository state, and the next concrete action.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Status
8
+
9
+ Remain read-only. Read project policy, state, active context packet, feature contract, evidence and closure records, plus repository status. Do not run broad tests solely for status.
10
+
11
+ Report current objective and risk, accountable role and active specialists, configured model profile and any fallback, implementation/automated/runtime/regression/docs/PO-gate states, closure mode and artifacts, blockers, stale records, and next concrete action.
12
+
13
+ For `brief`, omit evidence detail. For `full`, add requirement mapping, source revision freshness, role/model routing, hook health, linked artifact completion, working-tree summary, and recent decisions. For a feature ID, scope the report to that feature.
14
+
15
+ Use IMPLEMENTED, VERIFIED, VALIDATED, DONE, or BLOCKED exactly. Never show DONE while a configured artifact, strict checklist, objective check, or manual gate is incomplete without a valid item-specific waiver.
16
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: story-readiness
3
+ description: Checks whether a feature or story is safe and specific enough to implement, including requirements, decisions, dependencies, ownership, tests, and Product Owner gates.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Story Readiness
8
+
9
+ Read `.nccgs/project.yaml`, `.nccgs/state.md`, and the active context packet when present. Preserve Product Owner authority and unrelated work.
10
+
11
+ Remain read-only. Check approved objective, stable requirements, acceptance criteria, governing decisions, dependencies, ownership, protected paths, compatibility, testability, and unresolved semantics. Verify the context packet source revisions. Return READY, READY WITH RISKS, or BLOCKED with exact missing inputs and the smallest next action. Do not demand documents that add no implementation value.
12
+
13
+ Return outcome, evidence, affected records, blockers or decisions, residual risk, and the exact next workflow. Do not claim DONE unless this is the `closure` skill and every configured gate passes.
14
+
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: test
3
+ description: Plans or executes requirement-based Unity verification using automated tests, Unity CLI/Pipeline, runtime, build, regression, profiling, and explicit Product Owner gates. Use to prove behavior or reproduce failures without changing intended semantics.
4
+ allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
5
+ ---
6
+
7
+ # Test
8
+
9
+ Read policy, context packet, requirements, decisions, implementation, existing tests, and baseline. Classify each target as objective verification, regression, or subjective validation.
10
+
11
+ Use `/qa-plan` when coverage is not obvious. Choose the strongest proportional evidence described in the [evidence protocol](../../nccgs/protocols/evidence.md). Use official Unity Skills and `unity-cli` for Unity operations.
12
+
13
+ Run existing relevant checks first. Add deterministic tests only when the surrounding request authorizes implementation; remain read-only for a standalone audit. Capture environment, commands/actions, counts, skips, baseline comparison, runtime/build state, console errors, and regressions.
14
+
15
+ Use an independent verification role for STANDARD/CONTROLLED work. Verdicts are PASS, FAIL, NOT PROVEN, PO GATE, or N/A with reason. Do not mark the feature DONE; hand evidence to `/evidence-review` and `/closure`.
16
+
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: ui
3
+ description: Unity UI expert for menus, HUDs, screens, panels, buttons, labels, and all visual interface elements. Handles questions about UI in scenes or prefabs (how many elements, what exists, structure analysis), styling changes (colors, borders, backgrounds, fonts, spacing, rounded corners), layout adjustments, and UI generation. Routes to UI Toolkit, uGUI, or IMGUI based on project context.
4
+ ---
5
+
6
+ Determine the appropriate UI system for the project and route to the correct specialized skill.
7
+
8
+ ## When to Route vs Answer Directly
9
+
10
+ **Route to a specialized skill when:**
11
+ - User wants to understand, edit, or generate specific UI elements
12
+ - User references specific files or UI objects
13
+ - User asks for UI changes or creation
14
+
15
+ **Answer directly (without routing) when:**
16
+ - User asks comparative/educational questions ("What's the difference between UI Toolkit and uGUI?")
17
+ - User asks about UI system capabilities or recommendations ("Should I use UITK or uGUI for mobile?")
18
+ - User needs conceptual explanation of Unity UI architecture
19
+
20
+ ## Routing Logic
21
+
22
+ **Step 1: Check for explicit file references or keywords:**
23
+
24
+ | User mentions | Route to |
25
+ |---------------|----------|
26
+ | `.uxml` or `.uss` files (including in `/Editor/`) | `ui-uitk` |
27
+ | "UI Toolkit", "UITK", "UIElements", "CreateGUI" | `ui-uitk` |
28
+ | Canvas prefabs/objects, `.prefab` with UI | `ui-ugui` |
29
+ | "uGUI", "Canvas", "RectTransform", "legacy UI" | `ui-ugui` |
30
+ | "IMGUI", "OnGUI", "OnInspectorGUI", "immediate mode" | `ui-imgui` |
31
+ | Figma URL (`figma.com/design/...`), "Figma", "import from Figma" | Not available — see below |
32
+
33
+ **For editor-related requests (EditorWindow, custom inspector, PropertyDrawer):**
34
+ - If no explicit UI system mentioned → **Go to Step 2** to detect project's editor UI system
35
+ - If no existing pattern is detected, default to `ui-uitk` for new editor UI
36
+ - Only use `ui-imgui` if project exclusively uses IMGUI or user explicitly requests it
37
+
38
+ If explicit file or keywords found, activate the corresponding skill immediately.
39
+
40
+ **Step 2: If ambiguous, detect from project:**
41
+
42
+ Search the project to determine which UI system is in use:
43
+
44
+ | Look for | Indicates |
45
+ |----------|-----------|
46
+ | `.uxml` or `.uss` files (including in `/Editor/`) | UI Toolkit (runtime or editor) |
47
+ | `UIDocument` components in scenes | UI Toolkit (runtime) |
48
+ | Editor scripts with `CreateGUI()` method | UI Toolkit (editor) |
49
+ | `Canvas` in scenes/prefabs | uGUI |
50
+ | `RectTransform` heavy usage | uGUI |
51
+ | Editor scripts with `OnGUI()` or `OnInspectorGUI()` | IMGUI (legacy editor) |
52
+
53
+ **Step 3: If still unclear, ask or default:**
54
+
55
+ - For existing projects: detect and follow whichever framework is already in use (Step 2)
56
+ - For new projects with no UI yet: ask the user which framework they prefer (UI Toolkit vs uGUI), briefly explaining that UI Toolkit is modern/CSS-like while uGUI is Canvas-based/mature
57
+ - For new runtime/game UI where the user has no preference: default to uGUI (`ui-ugui`)
58
+ - When the user mentions mobile/performance constraints or older Unity versions (pre-6.0): bias toward uGUI (`ui-ugui`)
59
+
60
+ ## Request Types
61
+
62
+ Specialized skills handle three types of requests:
63
+
64
+ | Type | Examples |
65
+ |------|----------|
66
+ | **Understanding** | "What does this button do?", "How is this laid out?", "Explain this UI" |
67
+ | **Editing** | "Change this color", "Add a label here", "Fix this layout" |
68
+ | **Generation** | "Create a menu", "Make an inventory screen", "Build a settings panel" |
69
+
70
+ Route all types to the appropriate specialized skill based on the UI system.
71
+
72
+ ## Available Sub-Skills
73
+
74
+ ### UI Toolkit — `ui-uitk`
75
+ - For Unity 6.0+ projects using UI Toolkit (runtime game UI and editor tools)
76
+ - **Understands**, **edits**, and **generates** `.uxml` and `.uss` files
77
+ - Modern, CSS-like styling approach
78
+ - Preferred for new editor windows (CreateGUI) and existing UI Toolkit projects
79
+
80
+ ### uGUI — `ui-ugui`
81
+ - For projects using Unity's Canvas-based UI system
82
+ - **Understands**, **edits**, and **generates** Canvas hierarchies
83
+ - Uses Layout Groups for responsive design
84
+ - Default for new runtime/game UI when the user has no framework preference
85
+
86
+ ### IMGUI — `ui-imgui`
87
+ - For legacy editor tools using OnGUI/immediate mode
88
+ - Only use when project has existing IMGUI editor code or user explicitly requests IMGUI
89
+ - **Understands**, **edits**, and **generates** EditorWindow, inspectors, PropertyDrawers built with OnGUI
90
+ - Not for runtime game UI — for new editor tools, use UI Toolkit unless the project already uses IMGUI exclusively
91
+
92
+ ### Figma design import — not available here
93
+
94
+ Importing a Figma design requires Unity's Figma integration service, which only exists
95
+ inside Unity AI Assistant. There is no client-side equivalent, so do not promise it.
96
+
97
+ If the user brings a Figma URL, say the automated import is not available here and offer
98
+ the alternative: ask them to describe or screenshot the screen, then build it with the
99
+ appropriate framework skill above.
100
+
101
+ ## Common Guidelines (All UI Systems)
102
+
103
+ ### Scope Discipline
104
+
105
+ **Do only what is requested:**
106
+ - Question → answer without making changes
107
+ - Targeted edit → modify only what's specified
108
+ - Generation → create only requested files
109
+ - Don't proactively add scripts unless explicitly asked
110
+
111
+ **These do NOT imply scripts:**
112
+ - "proper buttons" → well-styled buttons
113
+ - "working UI" → valid UI that renders
114
+ - "menu screen" → visual layout only
115
+
116
+ ### Conventions
117
+
118
+ **Follow project patterns first.** Search existing files before applying defaults.
119
+
120
+ | Type | Convention |
121
+ |------|------------|
122
+ | Element names | Follow project patterns, or camelCase |
123
+ | File organization | Match existing project structure |
124
+
125
+ ### Workflow
126
+
127
+ 1. **Determine UI system** — Use routing logic above
128
+ - For Figma requests, tell the user the automated import is not available here, then
129
+ work from their description or screenshot and continue with framework detection
130
+ 2. **Activate specialized skill** — Route to `ui-uitk`, `ui-ugui`, or `ui-imgui`
131
+ 3. **Skill handles request** — Understanding, editing, or generation as appropriate
132
+
133
+ ## Handling Mixed Projects
134
+
135
+ Many Unity projects use multiple UI systems simultaneously (e.g., UI Toolkit for runtime game UI plus editor tools). When you detect multiple systems:
136
+
137
+ - **For runtime UI requests** (menus, HUDs, game screens) → Route to whichever runtime system (UITK or uGUI) is already in use
138
+ - **For editor tool requests** (custom inspectors, editor windows):
139
+ - **Prefer UI Toolkit** (CreateGUI) for new editor UI — it's the modern approach
140
+ - Only use IMGUI if the project's existing editor tools use IMGUI exclusively, or user explicitly requests IMGUI
141
+ - Check for existing editor `.uxml` files to confirm UITK usage
142
+ - **If creating new runtime UI in a mixed project** → Match the pattern used by similar existing UI; if there is no similar existing UI and the user has no preference, use uGUI
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: ui-imgui
3
+ description: Unity IMGUI (Immediate Mode GUI) expert for legacy editor tools using OnGUI/immediate mode. Generates and modifies IMGUI EditorWindows, custom Inspectors, PropertyDrawers, and scripts with IMGUI code (OnGUI, OnInspectorGUI). Use when maintaining existing IMGUI editor code or when user explicitly requests IMGUI/OnGUI.
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ **Before proceeding:** If the user is asking about creating a **new** editor window, custom inspector, or PropertyDrawer without explicitly mentioning IMGUI/OnGUI, recommend using UI Toolkit (CreateGUI) instead, as it's the modern approach. Only proceed with IMGUI if:
13
+ - User is modifying existing IMGUI code
14
+ - User explicitly requests IMGUI/immediate mode
15
+ - The project exclusively uses IMGUI for editor tools
16
+
17
+ When activated, read the reference files:
18
+ - [references/templates.md](references/templates.md) — EditorWindow, Inspector, PropertyDrawer templates
19
+ - [references/gui-elements.md](references/gui-elements.md) — GUI elements, layout groups, styling
20
+
21
+ ## When to Use This Skill
22
+
23
+ **IMPORTANT:** This skill is for **legacy IMGUI code only**. Use this skill when:
24
+
25
+ - User is maintaining/updating **existing** IMGUI editor code (files with `OnGUI()`, `OnInspectorGUI()`)
26
+ - User **explicitly requests** IMGUI/immediate mode GUI
27
+ - Project exclusively uses IMGUI for all editor tools
28
+
29
+ **Do NOT use this skill for:**
30
+ - New editor windows (use UI Toolkit with `CreateGUI()` instead)
31
+ - New custom inspectors (use UI Toolkit instead)
32
+ - Requests that don't explicitly mention IMGUI or OnGUI
33
+
34
+ **Legacy IMGUI is used for:**
35
+ - **Editor windows** — `EditorWindow` classes with `OnGUI()`
36
+ - **Custom inspectors** — `Editor`, `PropertyDrawer` classes with `OnInspectorGUI()`
37
+ - **Debug overlays** — `OnGUI()` in MonoBehaviour (runtime)
38
+
39
+ IMGUI is **not** for runtime game UI — use UI Toolkit or uGUI instead.
40
+
41
+ ## Scope
42
+
43
+ **Generate only what is requested (for legacy IMGUI code):**
44
+
45
+ | Request | Output | Note |
46
+ |---------|--------|------|
47
+ | Editor window (IMGUI/OnGUI) | `EditorWindow` with `OnGUI()` | Only if explicitly IMGUI |
48
+ | Custom inspector (IMGUI) | `Editor` with `OnInspectorGUI()` | Only if explicitly IMGUI |
49
+ | Property drawer (IMGUI) | `PropertyDrawer` with `OnGUI()` | Only if explicitly IMGUI |
50
+ | Debug overlay | `MonoBehaviour` with `OnGUI()` | Runtime debugging |
51
+ | Update existing IMGUI script | Modify existing OnGUI code | Always appropriate |
52
+
53
+ **Clarify if ambiguous:**
54
+ - "inspector" → Custom Editor for a specific type, or PropertyDrawer? **Also ask:** Should this use UI Toolkit (modern) or IMGUI (legacy)?
55
+ - "editor window" → **First ask:** Should this use UI Toolkit (modern/CreateGUI) or IMGUI (legacy/OnGUI)?
56
+ - "tool window" → EditorWindow with what functionality? Which UI system?
57
+
58
+ ## Conventions
59
+
60
+ **Follow project patterns first.** Search existing editor scripts before applying defaults.
61
+
62
+ | Type | Convention | Good | Bad |
63
+ |------|------------|------|-----|
64
+ | Script names | PascalCase | `MyToolWindow.cs` | `my-tool-window.cs` |
65
+ | EditorWindow | `[Name]Window.cs` | `LevelEditorWindow.cs` | `LevelEditor.cs` |
66
+ | Custom Editor | `[Type]Editor.cs` | `EnemyEditor.cs` | `EnemyInspector.cs` |
67
+ | PropertyDrawer | `[Type]Drawer.cs` | `RangeDrawer.cs` | `RangePropertyDrawer.cs` |
68
+ | Location | `Editor` folder | `Assets/Editor/` | `Assets/Scripts/` |
69
+
70
+ **Editor folder is required** — Scripts using `UnityEditor` namespace must be in an `Editor` folder or they will fail to build.
71
+
72
+ ## Workflow
73
+
74
+ 1. **Analyze** — Determine script type needed (EditorWindow, Editor, PropertyDrawer, etc.)
75
+ 2. **Search** — Find existing editor scripts to match patterns
76
+ 3. **Follow project patterns** — Match folder structure and naming
77
+ 4. **Create script** — Use appropriate base class and attributes
78
+ 5. **Implement OnGUI** — Build the interface with layout groups
79
+
80
+ ## Script Structure
81
+
82
+ ### EditorWindow
83
+ ```
84
+ [MenuItem attribute] → adds to menu
85
+ ShowWindow() static method → opens window
86
+ OnGUI() → draws interface
87
+ OnEnable/OnDisable → initialization/cleanup
88
+ ```
89
+
90
+ ### Custom Editor
91
+ ```
92
+ [CustomEditor attribute] → targets component type
93
+ OnInspectorGUI() → draws inspector
94
+ OnEnable() → cache SerializedProperties
95
+ serializedObject.Update/ApplyModifiedProperties → undo support
96
+ ```
97
+
98
+ ### PropertyDrawer
99
+ ```
100
+ [CustomPropertyDrawer attribute] → targets type or attribute
101
+ OnGUI(Rect, SerializedProperty, GUIContent) → draws property
102
+ GetPropertyHeight() → custom height if needed
103
+ ```
104
+
105
+ ## Key Rules
106
+
107
+ - **Cache GUIStyle objects** — never create new GUIStyle in OnGUI (causes memory allocation every frame)
108
+ - **Use SerializedProperty** — for proper undo/redo support in inspectors
109
+ - **Call ApplyModifiedProperties()** — after any serialized object changes
110
+ - **Use EditorGUILayout** — for editor scripts (auto-layout)
111
+ - **Use GUILayout** — for runtime OnGUI
112
+ - **Begin/End pairs** — always match BeginHorizontal with EndHorizontal, etc.
113
+ - **Editor folder required** — scripts fail to build if not in Editor folder
114
+
115
+ ## Layout Basics
116
+
117
+ **Horizontal grouping:**
118
+ ```csharp
119
+ EditorGUILayout.BeginHorizontal();
120
+ // elements appear side by side
121
+ EditorGUILayout.EndHorizontal();
122
+ ```
123
+
124
+ **Vertical grouping:**
125
+ ```csharp
126
+ EditorGUILayout.BeginVertical("box");
127
+ // elements appear stacked, with box style
128
+ EditorGUILayout.EndVertical();
129
+ ```
130
+
131
+ **Scroll view:**
132
+ ```csharp
133
+ scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
134
+ // scrollable content
135
+ EditorGUILayout.EndScrollView();
136
+ ```
137
+
138
+ **Foldout section:**
139
+ ```csharp
140
+ showSection = EditorGUILayout.Foldout(showSection, "Section Name");
141
+ if (showSection)
142
+ {
143
+ EditorGUI.indentLevel++;
144
+ // section content
145
+ EditorGUI.indentLevel--;
146
+ }
147
+ ```
148
+
149
+ ## Common Patterns
150
+
151
+ **Button with action:**
152
+ ```csharp
153
+ if (GUILayout.Button("Do Something"))
154
+ {
155
+ // action here
156
+ }
157
+ ```
158
+
159
+ **Property field with label:**
160
+ ```csharp
161
+ EditorGUILayout.PropertyField(myProperty, new GUIContent("Label"));
162
+ ```
163
+
164
+ **Object reference field:**
165
+ ```csharp
166
+ myObject = (MyType)EditorGUILayout.ObjectField("Label", myObject, typeof(MyType), true);
167
+ ```
168
+
169
+ **Disabled group:**
170
+ ```csharp
171
+ EditorGUI.BeginDisabledGroup(condition);
172
+ // disabled elements
173
+ EditorGUI.EndDisabledGroup();
174
+ ```
175
+
176
+ ## Best Practices
177
+
178
+ - Use `SerializedObject` and `SerializedProperty` for undo support
179
+ - Cache property references in `OnEnable()`
180
+ - Use `EditorUtility.SetDirty()` only for non-serialized changes
181
+ - Use `Undo.RecordObject()` before modifying objects directly
182
+ - Use `EditorStyles` for consistent appearance
183
+ - Use `GUILayout.FlexibleSpace()` to push elements apart
184
+
185
+ See `references/templates.md` for complete script templates.
186
+ See `references/gui-elements.md` for full element reference.