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,235 @@
1
+ ---
2
+ name: ui-uitk
3
+ description: Unity UI Toolkit expert for Unity 6.0+. Understands, edits, and generates UXML and USS files with flex-based layouts. Use for requests involving .uxml, .uss, UI Toolkit, UIElements, UIDocument, UI runtime binding, Custom UI Elements, Manipulators or PanelSettings.
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ Understand existing Unity UI Toolkit code, make targeted edits, generate new UXML/USS files, Manipulators, and handle UI runtime binding.
13
+
14
+ ## References
15
+
16
+ Read these as needed:
17
+ - `references/uss-guide.md` — USS patterns and examples
18
+ - `references/svg-icons.md` — SVG icon generation (only when generating icons)
19
+ - `references/common-issues.md` — Common mistakes to avoid
20
+ - `references/ui-runtime-binding.md` — Patterns and guide to bind data to UI at runtime (only when requested or when bindings are involved)
21
+ - `references/painter2d.md` — Painter2D API for custom visuals: gradients, shapes, arcs, procedural drawing (read this whenever gradients, custom shapes, progress rings, procedural drawing, or any visual beyond what USS can express is needed)
22
+ - `references/pointermanipulator-guide.md` — Patterns and guide to create and use Manipulators (only when requested or when manipulators are involved). This helps with setting up drag and drop features or simple event handling for a Visual Element.
23
+ - `references/custom-elements.md` — Custom UI Element patterns and guide to create reusable components with UXML, USS, and C#. This helps with creating complex UI components for reuse across the project.
24
+
25
+ Paths are relative to this skill's folder — read `references/uss-guide.md` directly.
26
+
27
+ ## Understanding
28
+
29
+ When explaining UI structure, use this format:
30
+ ```
31
+ [ElementType] name="elementName" class="class1 class2"
32
+ ├── [ChildType] name="childName"
33
+ │ └── [GrandchildType]
34
+ └── [ChildType] class="another-class"
35
+ ```
36
+
37
+ ## Editing
38
+
39
+ **Common edit requests:**
40
+
41
+ | Request | Action |
42
+ |---------|--------|
43
+ | "Change button color" | Edit USS selector for that button |
44
+ | "Add a label here" | Add element to UXML at specified location |
45
+ | "Make this bigger" | Edit width/height in USS |
46
+ | "Hide this element" | Add `display: none` to USS or remove from UXML |
47
+ | "Rename this element" | Update `name` attribute in UXML |
48
+
49
+ **Don't over-edit:**
50
+ - Change only what's requested
51
+ - Preserve formatting and structure
52
+ - Don't "improve" unrelated code
53
+ - Don't add comments unless asked
54
+ - For targeted changes, prefer modifying specific elements or selectors over rewriting entire files — but use judgment; if a change touches most of the file, a rewrite may be cleaner
55
+ - Be careful not to accidentally drop existing elements, styles, or references when making edits
56
+ - **When editing USS**, focus on the properties and selectors relevant to the request — avoid unnecessary reorganization, but restructure if the change genuinely requires it
57
+
58
+ ## Validation
59
+
60
+ There is no way to validate UXML or USS from outside the Editor — Unity parses these
61
+ files on import and reports problems in the Console. Write the files, then have the
62
+ user check the result.
63
+
64
+ **Workflow:**
65
+
66
+ 1. Write the complete file to its target path in the project. Do not write partial or
67
+ draft content — a half-written UXML file is a parse error the moment the Editor
68
+ picks it up.
69
+ 2. Ask the user to focus the Unity Editor. That triggers a reimport of the changed
70
+ assets.
71
+ 3. Ask them to report anything in the Console. UXML parse errors name the file and
72
+ line; USS problems appear as warnings about unknown properties or selectors.
73
+ 4. Fix what they report and repeat from step 1.
74
+
75
+ **Because feedback costs a user round-trip, get it right the first time:**
76
+
77
+ - Finish all files before asking the user to check, so one reimport covers everything
78
+ rather than one per file.
79
+ - Re-read `references/uss-guide.md` and `references/common-issues.md` before writing,
80
+ rather than after an error comes back.
81
+ - Watch for the mistakes that survive a parse but render wrong — those will not appear
82
+ in the Console at all, so the user has to eyeball the UI. `references/common-issues.md`
83
+ lists them.
84
+
85
+ ## Generation
86
+
87
+ When creating new UI:
88
+
89
+ **Generate only what is requested:**
90
+
91
+ | Request | Output |
92
+ |---------|--------|
93
+ | USS only | `.uss` file only |
94
+ | UXML only | `.uxml` file only |
95
+ | UI screen / menu / panel | `.uss` + `.uxml` only |
96
+ | "with code" / "with logic" / "functional" | `.uss` + `.uxml` + `.cs` |
97
+
98
+ **These do NOT imply C#:**
99
+ - "proper buttons" → well-styled Button elements
100
+ - "currency display" → a Label element
101
+ - "working UI" → valid UXML/USS that renders
102
+ - "inventory screen" → visual layout only
103
+ - "inventory system" / "equipment system" / "crafting system" → Ask: "Should items be draggable?" If yes, see `references/pointermanipulator-guide.md` for patterns
104
+
105
+ **Generation workflow:**
106
+ 1. **Analyze** — Determine exactly what files are needed. No extras.
107
+ 2. **Search** — Find existing USS, UXML, assets. Don't assume paths.
108
+ 3. **Follow project patterns** — Match folder structure and naming conventions.
109
+ 4. **Reuse** — Check for shared stylesheets. Reuse if appropriate.
110
+ 5. **Write USS first** — Verify against restrictions below.
111
+ 6. **Write UXML** — Reference the USS, verify structure.
112
+ 7. **Write the files out complete** — never partial content; see Validation above for
113
+ how errors come back and why one round of files beats several.
114
+ 8. **Scene setup** — Assign PanelSettings if adding UI to scene.
115
+ 9. **Data binding** — If requested, add C# script with runtime data binding patterns (see `references/ui-runtime-binding.md`). Generate the scriptable object asset if needed. Assign the asset to the UI element root in UXML or via datasource in C#.
116
+
117
+ **Color, visibility, and specification rules:**
118
+ - **Ensure text is readable by default:** When choosing colors, ensure text contrasts with its background — but respect intentional low-contrast uses (disabled states, placeholder text, decorative elements). When using design tokens, check that text and background variables provide adequate contrast.
119
+ - **Honor exact values:** User-specified hex colors, pixel dimensions, spacing — use exactly as given. Do not approximate or substitute.
120
+
121
+ **Styling / Theme**
122
+ When styling UI or adjusting theme make sure to not only apply to the elements directly in the current UXML but also to the core elements of UI Toolkit which are composed of several child elements usually.
123
+
124
+ ## Conventions
125
+
126
+ **Follow project patterns first.** Search existing files before applying defaults.
127
+
128
+ | Type | Convention | Good | Bad |
129
+ |------|------------|------|-----|
130
+ | `name` attribute | camelCase | `submitButton` | `submit-button` |
131
+ | `class` attribute / USS | kebab-case | `.submit-button` | `.submitButton` |
132
+ | File paths | Feature folders | `Assets/UI/Inventory/` | `Assets/Scripts/UI/` |
133
+
134
+ **Output format:**
135
+ ```uxml Filename.uxml
136
+ <ui:UXML>...</ui:UXML>
137
+ ```
138
+ ```uss Filename.uss
139
+ .class { ... }
140
+ ```
141
+
142
+ ## USS Restrictions
143
+
144
+ Unity's USS is a subset of CSS. These properties do NOT exist — NEVER use them:
145
+
146
+ | NEVER Use | Use Instead |
147
+ |-----------|-------------|
148
+ | `border` shorthand | `border-width`, `border-color` separately |
149
+ | `gap` | `margin` on children |
150
+ | `z-index` | DOM order or parent nesting |
151
+ | `pointer-events` | `picking-mode` UXML attribute |
152
+ | `filter` | Not supported |
153
+ | `outline` | `border-*` properties |
154
+ | `box-shadow` | Nested elements or background image |
155
+ | `:first-child`, `:last-child`, `:nth-child` | Explicit classes |
156
+ | `[attribute]` selectors | Explicit classes |
157
+ | `transition-property: <value>` | Omit entirely, or `none`/`initial`/`inherit` only |
158
+ | `linear-gradient()`, `radial-gradient()` | Custom `VisualElement` with Painter2D (see `references/painter2d.md`) |
159
+
160
+ **Inline styles:** NEVER use `style="..."` in UXML. All styling in USS only.
161
+
162
+ **External URLs:** NEVER use `url()` with external paths. Only `url("project://database/Assets/...")`.
163
+
164
+ **Prefer flexible layouts over hardcoded sizes:**
165
+ - Use `flex-grow`, `flex-shrink`, or `%` instead of fixed `width`/`height` values
166
+ - Let elements flow naturally and be constrained by their parent container
167
+ - Set explicit pixel sizes only on root containers or when a fixed size is truly required
168
+ - Child elements should adapt to available space rather than define their own dimensions
169
+
170
+ ## USS Brevity
171
+
172
+ - No default values (`flex-direction: column` is default)
173
+ - No default fonts
174
+ - No redundant constraints (`width: 100px` doesn't need `min-width`/`max-width`)
175
+ - No overlapping properties (`flex: 1` already sets grow/shrink)
176
+ - Simplest selector that works
177
+ - Never duplicate selectors
178
+
179
+ ## UXML
180
+
181
+ Every file must:
182
+ 1. Declare namespace: `<ui:UXML xmlns:ui="UnityEngine.UIElements">`
183
+ 2. Link stylesheet(s): `<ui:Style src="Screen.uss" />`
184
+ 3. Have exactly one top-level container
185
+ 4. **No `style="..."` attributes** — use USS only
186
+
187
+ ```uxml
188
+ <ui:UXML xmlns:ui="UnityEngine.UIElements">
189
+ <ui:Style src="Panel.uss" />
190
+ <ui:VisualElement name="root" class="panel">
191
+ <!-- content -->
192
+ </ui:VisualElement>
193
+ </ui:UXML>
194
+ ```
195
+
196
+ ## Events and Interactivity
197
+ - Use Pointer Manipulators for event handling and interactivity on a VisualElement (see `references/pointermanipulator-guide.md`)
198
+ - If drag and drop is requested then write a pointer Manipulator and attach it to the relevant Visual Element in UXML or via C#.
199
+ - For simple click events, you can use the `clickable` manipulator in UXML
200
+ - For more advanced interactions, create use more traditional event callbacks in C# and attach them to elements as needed
201
+
202
+ **For inventory and crafting systems:**
203
+ - When users request an "inventory system", "equipment system", or "crafting system", ask explicitly: "Should players be able to drag and drop items?"
204
+ - If yes, read `references/pointermanipulator-guide.md` for inventory/crafting-specific patterns
205
+ - If no or unclear, create static layout only
206
+
207
+ ## Assets
208
+
209
+ **Do NOT reference `UnityDefaultRuntimeTheme.tss`** or Unity's built-in theme icons.
210
+
211
+ **Icon priority:**
212
+ 1. Reuse existing project icons
213
+ 2. Generate SVG (see `references/svg-icons.md`)
214
+ 3. Image generators (last resort)
215
+
216
+ **Reference format:**
217
+ ```uss
218
+ background-image: url("project://database/Assets/UI/Textures/icon.png");
219
+ ```
220
+
221
+ ## Scene Setup
222
+
223
+ **PanelSettings is required** — UI won't render without it.
224
+
225
+ 1. Search for existing PanelSettings asset
226
+ 2. If none, create generic: `Assets/UI/PanelSettings.asset`
227
+ 3. Assign to UIDocument's `Panel Settings` field
228
+
229
+ Skip for Editor UI (EditorWindow, PropertyDrawer).
230
+
231
+ ## C# (Only When Requested)
232
+
233
+ - Style via USS classes (`AddToClassList()`) — never use `element.style.*` as inline styles have higher specificity than USS selectors, making them impossible to override via stylesheets, and add per-element memory overhead
234
+ - UITK uses TextCore text assets — use `FontAsset`, `TextStyleSheet`, and `TextSettings`, not their TextMeshPro equivalents (`TMP_FontAsset`, etc.)
235
+ - Place scripts in same folder as UXML/USS
@@ -0,0 +1,74 @@
1
+ # Common USS/UXML Issues
2
+
3
+ ## Transitions on :hover
4
+
5
+ Transitions must be defined on the base class, not the hover state:
6
+
7
+ ```uss
8
+ /* WRONG - won't animate on hover-out */
9
+ .button:hover {
10
+ background-color: blue;
11
+ transition-duration: 0.2s;
12
+ }
13
+
14
+ /* CORRECT */
15
+ .button {
16
+ background-color: white;
17
+ transition-duration: 0.2s;
18
+ }
19
+ .button:hover {
20
+ background-color: blue;
21
+ }
22
+ ```
23
+
24
+ ## Hardcoded Percentage Widths
25
+
26
+ Avoid hardcoded percentages for flexible layouts:
27
+
28
+ ```uss
29
+ /* AVOID */
30
+ .column {
31
+ width: 33%;
32
+ }
33
+
34
+ /* PREFER */
35
+ .column {
36
+ flex-grow: 1;
37
+ }
38
+ ```
39
+
40
+ ## Unclosed Brackets
41
+
42
+ Always ensure brackets are properly closed:
43
+
44
+ ```uss
45
+ /* WRONG - missing closing bracket */
46
+ .panel {
47
+ padding: 16px;
48
+
49
+ .button {
50
+ color: white;
51
+ }
52
+
53
+ /* CORRECT */
54
+ .panel {
55
+ padding: 16px;
56
+ }
57
+
58
+ .button {
59
+ color: white;
60
+ }
61
+ ```
62
+
63
+ ## Referencing Unity Theme
64
+
65
+ **Do NOT reference `UnityDefaultRuntimeTheme.tss`** or built-in theme icons.
66
+
67
+ Create custom styles or reuse project assets instead.
68
+
69
+ ## Performance Issues
70
+
71
+ - **Inline styles** cause per-element memory overhead
72
+ - **`:hover` on parents** with many children invalidates entire hierarchies
73
+ - **Many classes per element** decreases selector performance linearly
74
+ - **Large hierarchies** are the main performance factor
@@ -0,0 +1,241 @@
1
+ # Custom VisualElements in UI Toolkit
2
+
3
+ Guide for creating custom VisualElements using Unity 6+ `[UxmlElement]` and `[UxmlAttribute]` attributes.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Requirements](#requirements)
9
+ - [Supported Property Types](#supported-property-types)
10
+ - [Advanced Patterns](#advanced-patterns)
11
+ - [Best Practices](#best-practices)
12
+ - [UXML Namespace Declaration](#uxml-namespace-declaration)
13
+ - [UI Builder Integration](#ui-builder-integration)
14
+ - [Summary](#summary)
15
+
16
+ ## Overview
17
+
18
+ Unity 6+ uses attribute-based custom elements. The old factory pattern (`IUxmlFactory`, `UxmlTraits`) is **deprecated**.
19
+
20
+ ### ⚠️ CRITICAL: Namespace Declaration
21
+
22
+ **Never include assembly names in UXML namespace declarations:**
23
+
24
+ ```xml
25
+ ❌ WRONG: xmlns:custom="Game.UI.Custom, Assembly-CSharp"
26
+ ✅ CORRECT: xmlns:custom="Game.UI.Custom"
27
+ ```
28
+
29
+ **Format**: `xmlns:prefix="Namespace.Path"` (namespace only, no assembly)
30
+
31
+ ### Basic Pattern
32
+
33
+ ```csharp
34
+ [UxmlElement]
35
+ public partial class MyElement : VisualElement
36
+ {
37
+ [UxmlAttribute]
38
+ public string myValue { get; set; }
39
+ }
40
+ ```
41
+
42
+ ```xml
43
+ <ui:UXML xmlns:ui="UnityEngine.UIElements"
44
+ xmlns:custom="Game.UI.Custom">
45
+ <custom:MyElement my-value="Hello" />
46
+ </ui:UXML>
47
+ ```
48
+
49
+ ## Requirements
50
+
51
+ 1. **[UxmlElement]** attribute on the class
52
+ 2. **partial** keyword required
53
+ 3. Inherit from **VisualElement** or subclass
54
+ 4. **[UxmlAttribute]** on exposed properties
55
+
56
+ ### Property Naming
57
+
58
+ C# camelCase → UXML kebab-case:
59
+ - `myStringValue` → `my-string-value`
60
+ - `maxHealth` → `max-health`
61
+
62
+ ### Example
63
+
64
+ ```csharp
65
+ [UxmlElement]
66
+ public partial class CustomLabel : Label
67
+ {
68
+ [UxmlAttribute]
69
+ public Color textColor { get; set; } = Color.white;
70
+
71
+ [UxmlAttribute]
72
+ public int fontSize { get; set; } = 14;
73
+
74
+ public CustomLabel()
75
+ {
76
+ RegisterCallback<GeometryChangedEvent>(evt => {
77
+ style.color = textColor;
78
+ style.fontSize = fontSize;
79
+ });
80
+ }
81
+ }
82
+ ```
83
+
84
+ ```xml
85
+ <custom:CustomLabel text="Hello" text-color="rgb(255,215,0)" font-size="24" />
86
+ ```
87
+
88
+ ## Supported Property Types
89
+
90
+ **Basic**: `string`, `int`, `float`, `bool`, `Color`
91
+ **Unity**: `Texture2D`, `Sprite`, `Font`
92
+ **Enums**: Any enum type
93
+ **Collections**: `List<T>`, `T[]`
94
+
95
+ ### Image Handling
96
+
97
+ **Static images** (don't change) → Use USS:
98
+ ```css
99
+ .icon { background-image: url('project://Assets/UI/Icons/fireball.png'); }
100
+ ```
101
+
102
+ **Dynamic images** (change per instance) → Use `[UxmlAttribute]`:
103
+ ```csharp
104
+ [UxmlAttribute]
105
+ public Sprite portrait { get; set; } // Different per character
106
+ ```
107
+
108
+ ## Advanced Patterns
109
+
110
+ ### Validation Attributes
111
+
112
+ ```csharp
113
+ [UxmlAttribute]
114
+ [Range(0, 100)]
115
+ [Tooltip("Current health value")]
116
+ public float health { get; set; } = 100f;
117
+ ```
118
+
119
+ Improves UI Builder inspector experience.
120
+
121
+ ### Custom Attribute Names
122
+
123
+ ```csharp
124
+ [UxmlAttribute("hp")]
125
+ public float health { get; set; } // Use "hp" in UXML
126
+ ```
127
+
128
+ ### Custom Type Converters
129
+
130
+ Use `UxmlAttributeConverter<T>` when a property's type is not natively supported by UXML (e.g. structs, complex data objects). An example below implements `FromString` to parse the UXML attribute string into the specified type, then register it with `[UxmlAttributeConverter]` on the property.
131
+
132
+ ```csharp
133
+ public class HealthDataConverter : UxmlAttributeConverter<HealthData>
134
+ {
135
+ public override HealthData FromString(string value)
136
+ {
137
+ var parts = value.Split(',');
138
+ return new HealthData { current = float.Parse(parts[0]), max = float.Parse(parts[1]) };
139
+ }
140
+ }
141
+
142
+ [UxmlAttribute]
143
+ [UxmlAttributeConverter(typeof(HealthDataConverter))]
144
+ public HealthData healthData { get; set; }
145
+ ```
146
+
147
+ ### Custom Property Drawers
148
+
149
+ Create custom UI Builder inspector controls for your attributes:
150
+
151
+ ```csharp
152
+ // 1. Custom attribute
153
+ public class SliderDrawerAttribute : PropertyAttribute { }
154
+
155
+ // 2. Property drawer
156
+ [CustomPropertyDrawer(typeof(SliderDrawerAttribute))]
157
+ public class SliderDrawerPropertyDrawer : PropertyDrawer
158
+ {
159
+ public override VisualElement CreatePropertyGUI(SerializedProperty property)
160
+ {
161
+ var field = new SliderInt(0, 100) { label = property.displayName };
162
+ field.BindProperty(property);
163
+ return field;
164
+ }
165
+ }
166
+
167
+ // 3. Usage
168
+ [UxmlElement]
169
+ public partial class StyledButton : Button
170
+ {
171
+ [UxmlAttribute]
172
+ [SliderDrawer]
173
+ public int intensity { get; set; } = 50;
174
+ }
175
+ ```
176
+
177
+ **Override existing properties** with custom drawers:
178
+
179
+ ```csharp
180
+ [UxmlElement]
181
+ public partial class CustomIntField : IntegerField
182
+ {
183
+ // Override base 'value' property to use slider drawer in UI Builder
184
+ [UxmlAttribute("value"), SliderDrawer]
185
+ internal int myValue
186
+ {
187
+ get => this.value;
188
+ set => this.value = value;
189
+ }
190
+ }
191
+ ```
192
+
193
+ This customizes how properties appear in the UI Builder inspector.
194
+
195
+
196
+ ## Best Practices
197
+
198
+ 1. **Always use `partial`** - Required for [UxmlElement]
199
+ 2. **Provide defaults** - `public float radius { get; set; } = 30f;`
200
+ 3. **Update on changes** - Use property setters to call `UpdateVisuals()` or `MarkDirtyRepaint()`
201
+ 4. **Use backing fields** - When validation or change detection needed
202
+ 5. **USS for styling** - Add class names and style via USS, not inline styles
203
+ 6. **Static images → USS, Dynamic → C#** - Use USS `background-image` for fixed images
204
+ 7. **Document elements** - Add XML comments for better developer experience
205
+
206
+ ## UXML Namespace Declaration
207
+
208
+ ### Rules
209
+
210
+ 1. **Namespace only** - No assembly name, no commas
211
+ 2. **Exact match** - Must match C# namespace exactly (case-sensitive)
212
+ 3. **Format**: `xmlns:prefix="Namespace.Path"`
213
+
214
+ ### Examples
215
+
216
+ ```xml
217
+ <!-- ✅ Single namespace -->
218
+ <ui:UXML xmlns:ui="UnityEngine.UIElements"
219
+ xmlns:custom="Game.UI.Custom">
220
+ <custom:RadialProgress />
221
+ </ui:UXML>
222
+
223
+ <!-- ✅ Multiple namespaces -->
224
+ <ui:UXML xmlns:ui="UnityEngine.UIElements"
225
+ xmlns:hud="Game.UI.HUD"
226
+ xmlns:menu="Game.UI.Menu">
227
+ <hud:HealthBar />
228
+ <menu:SettingsPanel />
229
+ </ui:UXML>
230
+ ```
231
+
232
+ ### Common Mistakes
233
+
234
+ ```xml
235
+ ❌ xmlns:custom="Game.UI.Custom, Assembly-CSharp" (assembly name)
236
+ ❌ xmlns:custom="game.ui.custom" (wrong case)
237
+ ❌ xmlns:custom="Custom" (incomplete)
238
+ ❌ xmlns:custom="Game.UI.Custom.RadialProgress" (class name)
239
+
240
+ ✅ xmlns:custom="Game.UI.Custom" (correct)
241
+ ```