@aqian0/dsh-unity 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +53 -0
- package/LICENSE-UNITY-COMPANION.md +122 -0
- package/LICENSE.md +31 -0
- package/NOTICE.md +90 -0
- package/README.md +273 -2
- package/cordis.patch.yml +22 -0
- package/docs/design.md +297 -0
- package/icon.svg +16 -0
- package/lib/frontmatter.js +392 -0
- package/lib/gating.js +105 -0
- package/lib/harness.js +16 -0
- package/lib/index.js +171 -0
- package/lib/project.js +210 -0
- package/lib/registry.js +268 -0
- package/lib/requirements.js +214 -0
- package/lib/skills.js +191 -0
- package/lib/types/frontmatter.d.ts +84 -0
- package/lib/types/gating.d.ts +80 -0
- package/lib/types/harness.d.ts +152 -0
- package/lib/types/index.d.ts +75 -0
- package/lib/types/project.d.ts +93 -0
- package/lib/types/registry.d.ts +96 -0
- package/lib/types/requirements.d.ts +67 -0
- package/lib/types/skills.d.ts +54 -0
- package/lib/types/watch.d.ts +34 -0
- package/lib/watch.js +84 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +70 -4
- package/skills/2d-pixel-perfect/SKILL.md +208 -0
- package/skills/2d-pixel-perfect/references/api-reference.md +81 -0
- package/skills/2d-pixel-perfect/references/camera-setup-builtin.cs +40 -0
- package/skills/2d-pixel-perfect/references/camera-setup-urp.cs +49 -0
- package/skills/2d-pixel-perfect/references/pipeline-detection.cs +50 -0
- package/skills/2d-pixel-perfect/references/sprite-settings.cs +37 -0
- package/skills/asset-transformer-toolkit/SECURITY.md +15 -0
- package/skills/asset-transformer-toolkit/SKILL.md +39 -0
- package/skills/asset-transformer-toolkit/references/create-importer.md +121 -0
- package/skills/asset-transformer-toolkit/references/lods.md +61 -0
- package/skills/asset-transformer-toolkit/references/rule-api.md +154 -0
- package/skills/asset-transformer-toolkit/references/ruleblock-api.md +37 -0
- package/skills/asset-transformer-toolkit/references/ruleset-api.md +138 -0
- package/skills/asset-transformer-toolkit/references/rulesets-and-actions.md +227 -0
- package/skills/audio-setup-mixers/SECURITY.md +16 -0
- package/skills/audio-setup-mixers/SKILL.md +127 -0
- package/skills/audio-setup-mixers/references/api.md +162 -0
- package/skills/build-gtk/SECURITY.md +16 -0
- package/skills/build-gtk/SKILL.md +200 -0
- package/skills/build-gtk/references/api-reference.md +33 -0
- package/skills/build-gtk/references/graph-api-gaps.md +96 -0
- package/skills/build-gtk/references/runtime-and-visualization.md +191 -0
- package/skills/build-gtk/references/state-machine-api.md +270 -0
- package/skills/build-gtk/references/where-the-docs-stop.md +49 -0
- package/skills/build-live-game/SKILL.md +159 -0
- package/skills/build-live-game/references/achievements.md +757 -0
- package/skills/build-live-game/references/apis.md +271 -0
- package/skills/build-live-game/references/authentication.md +431 -0
- package/skills/build-live-game/references/battlepass.md +904 -0
- package/skills/build-live-game/references/blueprints-and-samples.md +75 -0
- package/skills/build-live-game/references/cloud-code-cloudbehaviours.md +1111 -0
- package/skills/build-live-game/references/cloud-code-modules.md +1276 -0
- package/skills/build-live-game/references/cloud-code.md +58 -0
- package/skills/build-live-game/references/cloud-save.md +464 -0
- package/skills/build-live-game/references/deployment.md +231 -0
- package/skills/build-live-game/references/orientation.md +30 -0
- package/skills/build-live-game/references/player-account.md +821 -0
- package/skills/build-live-game/references/remote-config.md +96 -0
- package/skills/build-live-game/references/services-overview.md +76 -0
- package/skills/build-live-game/references/tooling.md +375 -0
- package/skills/build-live-game/references/ugs-cli.md +86 -0
- package/skills/craft-game-floors/SECURITY.md +23 -0
- package/skills/craft-game-floors/SKILL.md +134 -0
- package/skills/craft-game-floors/references/art-direction.md +85 -0
- package/skills/craft-game-floors/references/camera-rigs.md +51 -0
- package/skills/craft-game-floors/references/character-motion.md +35 -0
- package/skills/craft-game-floors/references/game-audio.md +47 -0
- package/skills/craft-game-floors/references/game-feel.md +68 -0
- package/skills/craft-game-floors/references/game-shell.md +45 -0
- package/skills/craft-game-floors/references/live-floor.md +35 -0
- package/skills/craft-game-floors/references/placeholder-assets.md +35 -0
- package/skills/craft-game-floors/references/scene-lighting.md +52 -0
- package/skills/craft-game-floors/references/toon-shading.md +34 -0
- package/skills/craft-game-floors/references/vfx.md +40 -0
- package/skills/craft-game-floors/references/visual-scorecard.md +43 -0
- package/skills/create-2d-physics/SECURITY.md +16 -0
- package/skills/create-2d-physics/SKILL.md +128 -0
- package/skills/create-2d-physics/references/2d-physics-core.md +155 -0
- package/skills/create-2d-physics/references/legacy-2d-physics.md +45 -0
- package/skills/create-tile-palette-or-rule-tiles/SKILL.md +95 -0
- package/skills/create-tile-palette-or-rule-tiles/references/hexagonalruletile.md +71 -0
- package/skills/create-tile-palette-or-rule-tiles/references/palette-create.md +38 -0
- package/skills/create-tile-palette-or-rule-tiles/references/ruletile-createempty.md +37 -0
- package/skills/create-tile-palette-or-rule-tiles/references/ruletile-createfromsegment.md +219 -0
- package/skills/create-tile-palette-or-rule-tiles/references/ruletile.md +95 -0
- package/skills/create-tile-palette-or-rule-tiles/scripts/CreatePaletteTemplate.cs +148 -0
- package/skills/create-tile-palette-or-rule-tiles/scripts/ManualWorkflowExample.cs +63 -0
- package/skills/create-tile-palette-or-rule-tiles/scripts/RuleTileGenerator.cs +61 -0
- package/skills/create-tile-palette-or-rule-tiles/scripts/TilemapRuleTileCreateFromSegment.cs +225 -0
- package/skills/fix-3d-physics-collisions/SECURITY.md +17 -0
- package/skills/fix-3d-physics-collisions/SKILL.md +139 -0
- package/skills/fix-3d-physics-collisions/references/collision-checklist.md +80 -0
- package/skills/fix-3d-physics-collisions/references/collision-debugger.md +18 -0
- package/skills/fix-3d-physics-collisions/references/console-errors-table.md +9 -0
- package/skills/fix-3d-physics-collisions/references/kinematic-trigger-facts.md +18 -0
- package/skills/fix-3d-physics-collisions/references/other-symptoms.md +29 -0
- package/skills/fix-3d-physics-collisions/references/raycast-checklist.md +8 -0
- package/skills/fix-3d-physics-collisions/references/topic-map.md +42 -0
- package/skills/fix-3d-physics-collisions/references/trigger-checklist.md +9 -0
- package/skills/fix-3d-physics-collisions/scripts/CollisionDebugger.cs +561 -0
- package/skills/generate-editor-search-query/SECURITY.md +17 -0
- package/skills/generate-editor-search-query/SKILL.md +117 -0
- package/skills/generate-editor-search-query/references/open-search-window.md +70 -0
- package/skills/generate-editor-search-query/references/query-patterns.md +124 -0
- package/skills/implement-in-app-purchases/SKILL.md +82 -0
- package/skills/implement-in-app-purchases/references/api-details.md +41 -0
- package/skills/implement-in-app-purchases/references/api-notes.md +105 -0
- package/skills/implement-in-app-purchases/references/codeless-catalog.md +197 -0
- package/skills/implement-in-app-purchases/references/convert-adapty.md +270 -0
- package/skills/implement-in-app-purchases/references/convert-essentialkit.md +239 -0
- package/skills/implement-in-app-purchases/references/convert-revenuecat.md +277 -0
- package/skills/implement-in-app-purchases/references/convert-unipay.md +145 -0
- package/skills/implement-in-app-purchases/references/migration-v4-to-v5.md +46 -0
- package/skills/implement-in-app-purchases/references/path-add-iap-to-new-project.md +197 -0
- package/skills/implement-in-app-purchases/references/path-convert-native-google-billing.md +302 -0
- package/skills/implement-in-app-purchases/references/path-convert-native-storekit.md +357 -0
- package/skills/implement-in-app-purchases/references/path-implement-iap-d2c.md +253 -0
- package/skills/implement-in-app-purchases/references/platform-notes.md +55 -0
- package/skills/implement-in-app-purchases/references/pre-check.md +207 -0
- package/skills/implement-in-app-purchases/references/topic-map.md +46 -0
- package/skills/initialize-ai-navigation/SKILL.md +109 -0
- package/skills/initialize-ai-navigation/references/navigation-system.md +793 -0
- package/skills/initialize-ai-navigation/references/topic-map.md +66 -0
- package/skills/levelplay-unity-integration/SKILL.md +122 -0
- package/skills/levelplay-unity-integration/references/adding-more-ad-formats.md +15 -0
- package/skills/levelplay-unity-integration/references/banner-api.md +927 -0
- package/skills/levelplay-unity-integration/references/best-practices.md +604 -0
- package/skills/levelplay-unity-integration/references/dependency-resolution.md +94 -0
- package/skills/levelplay-unity-integration/references/examples.md +10 -0
- package/skills/levelplay-unity-integration/references/ilrd-api.md +337 -0
- package/skills/levelplay-unity-integration/references/initialization-api.md +851 -0
- package/skills/levelplay-unity-integration/references/interstitial-api.md +907 -0
- package/skills/levelplay-unity-integration/references/ios-setup.md +463 -0
- package/skills/levelplay-unity-integration/references/migration-sdk-9.md +666 -0
- package/skills/levelplay-unity-integration/references/privacy-settings.md +593 -0
- package/skills/levelplay-unity-integration/references/production-release-checklist.md +22 -0
- package/skills/levelplay-unity-integration/references/rewarded-api.md +918 -0
- package/skills/levelplay-unity-integration/references/step-0-new-or-migration.md +8 -0
- package/skills/levelplay-unity-integration/references/step-1-verify-environment.md +4 -0
- package/skills/levelplay-unity-integration/references/step-10-testing.md +15 -0
- package/skills/levelplay-unity-integration/references/step-2-business-goals.md +12 -0
- package/skills/levelplay-unity-integration/references/step-3-install-sdk.md +55 -0
- package/skills/levelplay-unity-integration/references/step-4-native-dependencies.md +22 -0
- package/skills/levelplay-unity-integration/references/step-5-app-key-and-ad-units.md +18 -0
- package/skills/levelplay-unity-integration/references/step-6-5-privacy-and-regulation.md +51 -0
- package/skills/levelplay-unity-integration/references/step-6-admob-keys.md +16 -0
- package/skills/levelplay-unity-integration/references/step-7-initialize.md +50 -0
- package/skills/levelplay-unity-integration/references/step-8-ad-unit-strategy.md +16 -0
- package/skills/levelplay-unity-integration/references/step-9-implement-ad-units.md +66 -0
- package/skills/levelplay-unity-integration/references/testing-and-validation.md +222 -0
- package/skills/levelplay-unity-integration/references/troubleshooting.md +99 -0
- package/skills/localize-unity-project/SKILL.md +159 -0
- package/skills/localize-unity-project/references/api-notes.md +15 -0
- package/skills/localize-unity-project/references/cjk-fonts.md +83 -0
- package/skills/localize-unity-project/references/docs-map.md +42 -0
- package/skills/localize-unity-project/references/documentation-lookup.md +33 -0
- package/skills/localize-unity-project/references/locale-switching.md +17 -0
- package/skills/localize-unity-project/references/table-completeness-check.md +47 -0
- package/skills/localize-unity-project/references/translating-existing-project.md +47 -0
- package/skills/localize-unity-project/references/translation-strategy.md +41 -0
- package/skills/localize-unity-project/references/troubleshooting.md +12 -0
- package/skills/localize-unity-project/scripts/L10nBatchProcessor.cs +191 -0
- package/skills/localize-unity-project/scripts/LocalizedFontAsset.cs +18 -0
- package/skills/manage-sprite-atlas/SKILL.md +202 -0
- package/skills/manage-sprite-atlas/references/addressables-delivery.md +58 -0
- package/skills/manage-sprite-atlas/references/advanced-manual-authoring.md +19 -0
- package/skills/manage-sprite-atlas/references/api.md +382 -0
- package/skills/manage-sprite-atlas/references/best-practices.md +183 -0
- package/skills/manage-sprite-atlas/references/common-errors.md +123 -0
- package/skills/manage-sprite-atlas/references/complete-workflow.md +61 -0
- package/skills/manage-sprite-atlas/references/custom-packing.md +147 -0
- package/skills/manage-sprite-atlas/references/delivery-mechanism.md +30 -0
- package/skills/manage-sprite-atlas/references/key-requirements.md +21 -0
- package/skills/manage-sprite-atlas/references/manual-authoring.md +39 -0
- package/skills/manage-sprite-atlas/references/namespaces.md +15 -0
- package/skills/manage-sprite-atlas/references/v2-architecture.md +21 -0
- package/skills/manage-sprite-atlas/resources/authoringvsruntime.cs +176 -0
- package/skills/manage-sprite-atlas/resources/buildaddressablespostprocess.cs +59 -0
- package/skills/manage-sprite-atlas/resources/cacheloadedatlases.cs +145 -0
- package/skills/manage-sprite-atlas/resources/cleanupbatchoperations.cs +119 -0
- package/skills/manage-sprite-atlas/resources/createandconfiguremasteratlas.cs +57 -0
- package/skills/manage-sprite-atlas/resources/custompackersetup.cs +88 -0
- package/skills/manage-sprite-atlas/resources/deprecatedmethods.cs +142 -0
- package/skills/manage-sprite-atlas/resources/dontmodifywithoutsaving.cs +120 -0
- package/skills/manage-sprite-atlas/resources/dontpackinruntimebuilds.cs +190 -0
- package/skills/manage-sprite-atlas/resources/dontscriptspriteatlasineditor.cs +114 -0
- package/skills/manage-sprite-atlas/resources/editorconfiguration.cs +95 -0
- package/skills/manage-sprite-atlas/resources/enablespritepacking.cs +172 -0
- package/skills/manage-sprite-atlas/resources/gridspritepacker.cs +50 -0
- package/skills/manage-sprite-atlas/resources/handlelatebinding.cs +147 -0
- package/skills/manage-sprite-atlas/resources/handlenullcases.cs +141 -0
- package/skills/manage-sprite-atlas/resources/migratev1tov2.cs +335 -0
- package/skills/manage-sprite-atlas/resources/multipagepacker.cs +80 -0
- package/skills/manage-sprite-atlas/resources/optimizetexturesettings.cs +191 -0
- package/skills/manage-sprite-atlas/resources/packerdebugging.cs +158 -0
- package/skills/manage-sprite-atlas/resources/packtransform.cs +51 -0
- package/skills/manage-sprite-atlas/resources/platformnames.cs +127 -0
- package/skills/manage-sprite-atlas/resources/queryspritesefficiently.cs +222 -0
- package/skills/manage-sprite-atlas/resources/registercallbacks.cs +152 -0
- package/skills/manage-sprite-atlas/resources/runtimeatlasloader.cs +15 -0
- package/skills/manage-sprite-atlas/resources/runtimespriteaccess.cs +19 -0
- package/skills/manage-sprite-atlas/resources/savespriteatlasasset.cs +107 -0
- package/skills/manage-sprite-atlas/resources/scriptablepacker.cs +81 -0
- package/skills/manage-sprite-atlas/resources/setincludeinbuild.cs +164 -0
- package/skills/manage-sprite-atlas/resources/sizeoptimizedpacker.cs +88 -0
- package/skills/manage-sprite-atlas/resources/spriteatlaslatebinding.cs +123 -0
- package/skills/manage-sprite-atlas/resources/spriteatlasprebuildgenerator.cs +219 -0
- package/skills/manage-sprite-atlas/resources/spritedata.cs +35 -0
- package/skills/manage-sprite-atlas/resources/spritepack.cs +39 -0
- package/skills/manage-sprite-atlas/resources/texturedata.cs +15 -0
- package/skills/manage-sprite-atlas/resources/updatebuildscripts.cs +357 -0
- package/skills/manage-sprite-atlas/resources/updatesettingsconfiguration.cs +135 -0
- package/skills/manage-sprite-atlas/resources/usevariantswisely.cs +179 -0
- package/skills/manage-sprite-atlas/resources/variantatlas.cs +39 -0
- package/skills/migrate-birp-to-urp/SECURITY.md +16 -0
- package/skills/migrate-birp-to-urp/SKILL.md +167 -0
- package/skills/migrate-birp-to-urp/references/capturing-the-editor.md +66 -0
- package/skills/migrate-birp-to-urp/references/complex-shader-situations.md +272 -0
- package/skills/migrate-birp-to-urp/references/conversion-and-rendering-triage.md +113 -0
- package/skills/migrate-birp-to-urp/references/custom-shader-triage.md +123 -0
- package/skills/migrate-birp-to-urp/references/implementation-patterns.md +529 -0
- package/skills/migrate-birp-to-urp/references/migration-workflow.md +265 -0
- package/skills/migrate-birp-to-urp/references/parity-validation-and-troubleshooting.md +114 -0
- package/skills/migrate-birp-to-urp/references/preflight-and-urp-setup.md +195 -0
- package/skills/migrate-birp-to-urp/references/quality-settings-map.md +69 -0
- package/skills/new-unity-project/SECURITY.md +26 -0
- package/skills/new-unity-project/SKILL.md +171 -0
- package/skills/new-unity-project/references/checklist.md +18 -0
- package/skills/new-unity-project/references/common-mistakes.md +15 -0
- package/skills/new-unity-project/references/skill-setup.md +66 -0
- package/skills/new-unity-project/references/step-1-concept.md +13 -0
- package/skills/new-unity-project/references/step-2-platforms-and-create.md +31 -0
- package/skills/new-unity-project/references/step-3-join-and-reconcile.md +16 -0
- package/skills/new-unity-project/references/step-4-source-control.md +9 -0
- package/skills/new-unity-project/references/step-5-packages.md +18 -0
- package/skills/new-unity-project/references/step-6-identity-and-floors.md +20 -0
- package/skills/new-unity-project/references/step-7-visual-baseline.md +75 -0
- package/skills/new-unity-project/references/step-8-first-commit.md +21 -0
- package/skills/new-unity-project/references/step-9-handoff.md +23 -0
- package/skills/optimize-audio/SECURITY.md +16 -0
- package/skills/optimize-audio/SKILL.md +120 -0
- package/skills/optimize-audio/references/diagnostics.md +42 -0
- package/skills/optimize-audio/references/troubleshooting.md +41 -0
- package/skills/optimize-audio/resources/audio-import-api.md +149 -0
- package/skills/optimize-audio/resources/platform-settings.md +48 -0
- package/skills/optimize-text-mesh-pro/SKILL.md +181 -0
- package/skills/optimize-text-mesh-pro/references/dynamic-atlas-and-profiling.md +28 -0
- package/skills/optimize-text-mesh-pro/references/topic-map.md +36 -0
- package/skills/optimize-web/SECURITY.md +16 -0
- package/skills/optimize-web/SKILL.md +157 -0
- package/skills/optimize-web/references/editor-csharp.md +120 -0
- package/skills/optimize-web/references/topic-map.md +49 -0
- package/skills/optimize-web/references/troubleshooting.md +45 -0
- package/skills/optimize-web/references/understand-request.md +19 -0
- package/skills/optimize-web/references/web-assets-quality.md +59 -0
- package/skills/optimize-web/references/web-player-settings.md +39 -0
- package/skills/optimize-web/references/web-profiling-memory.md +71 -0
- package/skills/optimize-web/scripts/WebOptimizer.cs +46 -0
- package/skills/optimize-web/scripts/toktx-examples.sh +11 -0
- package/skills/setup-multiplayer-services/SKILL.md +36 -0
- package/skills/setup-multiplayer-services/references/dgs-entrypoint.md +79 -0
- package/skills/setup-multiplayer-services/references/entrypoints.md +213 -0
- package/skills/setup-multiplayer-services/references/examples.md +33 -0
- package/skills/setup-multiplayer-services/references/implementation-fit.md +30 -0
- package/skills/setup-multiplayer-services/references/underlying-services.md +11 -0
- package/skills/setup-multiplayer-services/references/workflows-prerequisites.md +17 -0
- package/skills/setup-vivox-voice-chat/SECURITY.md +16 -0
- package/skills/setup-vivox-voice-chat/SKILL.md +166 -0
- package/skills/setup-vivox-voice-chat/references/api-reference-lookup.md +28 -0
- package/skills/setup-vivox-voice-chat/references/docs-topic-map.md +13 -0
- package/skills/setup-vivox-voice-chat/references/events-and-participants.md +79 -0
- package/skills/setup-vivox-voice-chat/references/init-and-login.md +92 -0
- package/skills/setup-vivox-voice-chat/references/text-chat.md +93 -0
- package/skills/setup-vivox-voice-chat/references/troubleshooting.md +47 -0
- package/skills/setup-vivox-voice-chat/references/voice-channels.md +92 -0
- package/skills/shader-graph-create-custom-node/SKILL.md +25 -0
- package/skills/shader-graph-create-custom-node/resources/all_hints.hlsl +182 -0
- package/skills/sprite-editor/SECURITY.md +16 -0
- package/skills/sprite-editor/SKILL.md +66 -0
- package/skills/sprite-editor/references/api_reference.md +151 -0
- package/skills/sprite-editor/references/background.md +112 -0
- package/skills/sprite-editor/references/templates.md +72 -0
- package/skills/sprite-editor/scripts/AutomaticSliceTexture.cs +40 -0
- package/skills/sprite-editor/scripts/GenerateNewSpriteRects.cs +200 -0
- package/skills/sprite-editor/scripts/GetTextureSourceImageSize.cs +32 -0
- package/skills/sprite-editor/scripts/GetTextureToSlice.cs +55 -0
- package/skills/sprite-editor/scripts/GridSliceTexture.cs +40 -0
- package/skills/sprite-editor/scripts/IsometricSliceTexture.cs +141 -0
- package/skills/sprite-editor/scripts/README.md +134 -0
- package/skills/sprite-editor/scripts/SetPivotExample.cs +58 -0
- package/skills/sprite-editor/scripts/SpriteToPng.cs +88 -0
- package/skills/sprite-segment-3x3grid/SKILL.md +177 -0
- package/skills/sprite-segment-3x3grid/references/topic-map.md +37 -0
- package/skills/sprite-segment-3x3grid/scripts/SpriteGridAnalysis.cs +119 -0
- package/skills/ui/SKILL.md +142 -0
- package/skills/ui-imgui/SKILL.md +180 -0
- package/skills/ui-imgui/references/gui-elements.md +156 -0
- package/skills/ui-imgui/references/templates.md +141 -0
- package/skills/ui-ugui/SKILL.md +217 -0
- package/skills/ui-ugui/references/layout-and-anchors.md +61 -0
- package/skills/ui-ugui/references/scrollview-setup.md +29 -0
- package/skills/ui-uitk/SKILL.md +229 -0
- package/skills/ui-uitk/references/common-issues.md +74 -0
- package/skills/ui-uitk/references/custom-elements.md +241 -0
- package/skills/ui-uitk/references/painter2d.md +282 -0
- package/skills/ui-uitk/references/pointermanipulator-guide.md +94 -0
- package/skills/ui-uitk/references/svg-icons.md +136 -0
- package/skills/ui-uitk/references/ui-runtime-binding.md +234 -0
- package/skills/ui-uitk/references/uss-guide.md +138 -0
- package/skills/unity-cli/CHANGELOG.md +524 -0
- package/skills/unity-cli/SECURITY.md +68 -0
- package/skills/unity-cli/SKILL.md +160 -0
- package/skills/unity-cli/references/auth-license-cloud.md +318 -0
- package/skills/unity-cli/references/bootstrap-project.md +177 -0
- package/skills/unity-cli/references/build-run-test.md +555 -0
- package/skills/unity-cli/references/catalog-plugins.md +86 -0
- package/skills/unity-cli/references/ci-recipes.md +76 -0
- package/skills/unity-cli/references/cloud-automation.md +819 -0
- package/skills/unity-cli/references/cloud-workflows.md +19 -0
- package/skills/unity-cli/references/collaboration.md +533 -0
- package/skills/unity-cli/references/config-hub.md +239 -0
- package/skills/unity-cli/references/diagnostics-maintenance.md +718 -0
- package/skills/unity-cli/references/docs-workflow.md +179 -0
- package/skills/unity-cli/references/editor-targeting.md +29 -0
- package/skills/unity-cli/references/editors-install.md +490 -0
- package/skills/unity-cli/references/environment-variables.md +42 -0
- package/skills/unity-cli/references/exit-codes.md +47 -0
- package/skills/unity-cli/references/global-flags.md +32 -0
- package/skills/unity-cli/references/integration-advanced.md +1130 -0
- package/skills/unity-cli/references/notes.md +20 -0
- package/skills/unity-cli/references/notifications.md +39 -0
- package/skills/unity-cli/references/playmode-verification-loop.md +279 -0
- package/skills/unity-cli/references/projects-templates.md +997 -0
- package/skills/unity-cli/references/scene-editing-preflight.md +25 -0
- package/skills/unity-cli/references/setup-and-help.md +54 -0
- package/skills/unity-cli/references/version-control.md +612 -0
- package/skills/unity-package-management/SKILL.md +169 -0
- package/skills/unity-package-management/references/discovering-packages.md +66 -0
- package/skills/unity-package-management/references/headless-run.md +31 -0
- package/skills/unity-package-management/references/installer-script.md +92 -0
- package/skills/unity-package-management/references/select-packages.md +126 -0
- package/skills/unity-pipeline/SECURITY.md +17 -0
- package/skills/unity-pipeline/SKILL.md +205 -0
- package/skills/unity-pipeline/references/csharp-eval.md +23 -0
- package/skills/unity-pipeline/references/multiplayer-play-mode.md +103 -0
- package/skills/urp-postprocessing/SECURITY.md +16 -0
- package/skills/urp-postprocessing/SKILL.md +188 -0
- package/skills/urp-postprocessing/references/code-templates.md +150 -0
- package/skills/urp-postprocessing/references/effect-reference.md +86 -0
- package/skills/validate-urp-render-graph-renderer-feature/SKILL.md +92 -0
- package/skills/validate-urp-render-graph-renderer-feature/references/validation-checklist.md +179 -0
|
@@ -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,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sprite-segment-3x3grid
|
|
3
|
+
description: Segments a Sprite texture into a 3x3 grid and outputs a pattern of cells matching the center cell's color. Use when asked to analyze, compare, or document a sprite's structure or color distribution.
|
|
4
|
+
---
|
|
5
|
+
# Sprite Color Grid Analysis
|
|
6
|
+
|
|
7
|
+
Segment a sprite's texture into a 3x3 grid and output a text pattern showing which cells match the center cell's majority color.
|
|
8
|
+
|
|
9
|
+
## Important
|
|
10
|
+
|
|
11
|
+
- Use the unity cli (`unity command --format json`) and the `unity-cli` and `unity-pipeline` skills for each step.
|
|
12
|
+
- Don't use `using` directives or unqualified types in the `snippet` for `eval`. The compiler reads using `UnityEngine` and a bare AssetDatabase, Volume, or Object causes errors (CS0246 / CS0103 / CS0104). `return` what you want to read; it arrives at `data.result.result`.
|
|
13
|
+
- Create a restore point you can roll back to if your changes fail.
|
|
14
|
+
- Do only what's asked. Don't change unrelated assets or files.
|
|
15
|
+
- Never leave verification code in the user's script. Never build logging or detection they didn't ask for. See [Final step](#final-step).
|
|
16
|
+
- Avoid long explanations.
|
|
17
|
+
- This skill reads a sprite and reports a pattern, so don't edit the user's files unless they ask. If they do, create the restore point just before the first edit.
|
|
18
|
+
|
|
19
|
+
## Step 1
|
|
20
|
+
|
|
21
|
+
Before you go forward with a workflow or diagnosis:
|
|
22
|
+
|
|
23
|
+
1. Open and read the [documentation page(s)](#full-topic-map) that cover the specific subject related to what you intend to do or fix and check if you've missed anything.
|
|
24
|
+
2. Name the file(s) you read in your response.
|
|
25
|
+
|
|
26
|
+
This is because your training knowledge about Unity might be out of date, incorrect, or for the wrong Unity version.
|
|
27
|
+
|
|
28
|
+
## Full topic map
|
|
29
|
+
|
|
30
|
+
Documentation pages and API entry points: [references/topic-map.md](references/topic-map.md).
|
|
31
|
+
## Step 2. Procedure
|
|
32
|
+
|
|
33
|
+
1. Get the Unity version from `ProjectSettings/ProjectVersion.txt`, the sprite to analyze, and the match threshold. If there's no project or no version, assume Unity 6000.0, say so in your answer, and carry on. If the user gives no threshold, use the default from [Match Threshold](#match-threshold). If the user names no sprite, ask for it.
|
|
34
|
+
2. Read the [documentation pages](#full-topic-map) for what you're about to do.
|
|
35
|
+
3. Run the [Algorithm](#algorithm) on the sprite, following the [Implementation Guidance](#implementation-guidance). Use [scripts/SpriteGridAnalysis.cs](scripts/SpriteGridAnalysis.cs) as the code template. If you can't read the sprite's pixels (for example, there's no project), say so, explain how you'd calculate each cell, and carry on to the report.
|
|
36
|
+
4. Check the result against the [Output Format](#output-format): one line, three groups of three symbols separated by ` / `, with `*` in the center. If it doesn't match, reread the [documentation pages](#full-topic-map) and the [Algorithm](#algorithm), and run the analysis again.
|
|
37
|
+
5. If you changed the project or ran code in the Editor, run the checks in the [Final step](#final-step).
|
|
38
|
+
6. Report the result as described in the [Final report](#final-report).
|
|
39
|
+
|
|
40
|
+
## Parameters
|
|
41
|
+
|
|
42
|
+
### Match Threshold
|
|
43
|
+
|
|
44
|
+
The **match threshold** determines what percentage of pixels in a non-center cell must match the center's majority color for you to mark that cell as a match (`.`).
|
|
45
|
+
|
|
46
|
+
| Threshold | Description | Use Case |
|
|
47
|
+
|-----------|-------------|----------|
|
|
48
|
+
| **50%** | At least half the cell's pixels match center color | Lenient matching for sprites with mixed regions |
|
|
49
|
+
| **75%** | At least three-quarters match center color | Moderate matching for mostly solid regions |
|
|
50
|
+
| **90%** | Nearly all pixels must match center color | Strict matching for very uniform sprites |
|
|
51
|
+
|
|
52
|
+
**Default**: 75%
|
|
53
|
+
|
|
54
|
+
## Algorithm
|
|
55
|
+
|
|
56
|
+
1. **Segment the Sprite**: Divide the Sprite's texture region into a 3x3 grid (9 cells total)
|
|
57
|
+
2. **Identify Center Color**: Calculate the majority (most frequent) color in the center cell (position [1,1])
|
|
58
|
+
3. **Compare Each Cell**: For each of the 8 surrounding cells, calculate what percentage of pixels match the center's majority color. If the percentage meets or exceeds the **match threshold**, the cell is a match (`.`); otherwise it is not (`X`)
|
|
59
|
+
4. **Generate Output**: Create a text representation using the legend below
|
|
60
|
+
|
|
61
|
+
## Output Legend
|
|
62
|
+
|
|
63
|
+
| Symbol | Meaning |
|
|
64
|
+
|--------|---------|
|
|
65
|
+
| `X` | Cell does NOT meet the match threshold (insufficient pixels match center color) |
|
|
66
|
+
| `.` | Cell MEETS the match threshold (enough pixels match center color) |
|
|
67
|
+
| `*` | The center cell itself (always position [1,1] in the grid) |
|
|
68
|
+
|
|
69
|
+
## Output Format
|
|
70
|
+
|
|
71
|
+
Output a single line with three groups of three characters, separated by ` / `. Each group represents one row of the grid.
|
|
72
|
+
|
|
73
|
+
**Order**: Top to Bottom rows, Left to Right within each row.
|
|
74
|
+
|
|
75
|
+
**Format**: `[TopRow] / [MiddleRow] / [BottomRow]`
|
|
76
|
+
|
|
77
|
+
Each row contains 3 characters separated by spaces: `[Left] [Center] [Right]`
|
|
78
|
+
|
|
79
|
+
### Grid Position Mapping
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Grid Layout: Output Order:
|
|
83
|
+
[0,0] [1,0] [2,0] 1 2 3 -> First group
|
|
84
|
+
[0,1] [1,1] [2,1] 4 5 6 -> Second group (5 is always *)
|
|
85
|
+
[0,2] [1,2] [2,2] 7 8 9 -> Third group
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Examples
|
|
89
|
+
|
|
90
|
+
**Example 1**: Center matches top-left and bottom-right only
|
|
91
|
+
```
|
|
92
|
+
. X X / X * X / X X .
|
|
93
|
+
```
|
|
94
|
+
Grid interpretation:
|
|
95
|
+
```
|
|
96
|
+
. X X
|
|
97
|
+
X * X
|
|
98
|
+
X X .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Example 2**: Center matches all surrounding cells
|
|
102
|
+
```
|
|
103
|
+
. . . / . * . / . . .
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Example 3**: Center matches none of the surrounding cells
|
|
107
|
+
```
|
|
108
|
+
X X X / X * X / X X X
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Example 4**: Center matches bottom row only
|
|
112
|
+
```
|
|
113
|
+
X X X / X * X / . . .
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Implementation Guidance
|
|
117
|
+
|
|
118
|
+
### Calculating Center's Majority Color
|
|
119
|
+
|
|
120
|
+
For the center cell:
|
|
121
|
+
1. Sample all pixels within the cell's bounds
|
|
122
|
+
2. Group pixels by color (consider using a color tolerance threshold for similar colors)
|
|
123
|
+
3. The majority color is the color with the highest pixel count
|
|
124
|
+
4. For tie-breaking, use the first color encountered
|
|
125
|
+
|
|
126
|
+
### Matching Non-Center Cells
|
|
127
|
+
|
|
128
|
+
For each of the 8 surrounding cells:
|
|
129
|
+
1. Count the total number of pixels in the cell
|
|
130
|
+
2. Count how many pixels match the center's majority color (using color tolerance)
|
|
131
|
+
3. Calculate the match percentage: `matchingPixels / totalPixels`
|
|
132
|
+
4. If match percentage >= threshold, cell is a match (`.`); otherwise (`X`)
|
|
133
|
+
|
|
134
|
+
### Color Tolerance
|
|
135
|
+
|
|
136
|
+
When comparing pixel colors:
|
|
137
|
+
- Consider using a tolerance threshold (e.g., RGB distance < 10) for "matching"
|
|
138
|
+
- Alternatively, for sprites with limited palettes, exact matching may be appropriate
|
|
139
|
+
- Account for alpha channel if relevant to the use case
|
|
140
|
+
|
|
141
|
+
### Sprite Bounds
|
|
142
|
+
|
|
143
|
+
Use the Sprite's `rect` property to determine the pixel region to analyze:
|
|
144
|
+
- `sprite.rect.x`, `sprite.rect.y` for the origin
|
|
145
|
+
- `sprite.rect.width`, `sprite.rect.height` for dimensions
|
|
146
|
+
- Divide width and height by 3 to get cell dimensions
|
|
147
|
+
|
|
148
|
+
## Notes
|
|
149
|
+
|
|
150
|
+
- This analysis works best with sprites that have distinct color regions
|
|
151
|
+
- For sprites with gradients or many colors, consider increasing color tolerance
|
|
152
|
+
- Flip the y-axis from Unity's texture coordinates so the output runs top to bottom
|
|
153
|
+
- Treat transparent pixels as a distinct "color", or ignore them, depending on the use case
|
|
154
|
+
|
|
155
|
+
## Final step
|
|
156
|
+
|
|
157
|
+
Do the following checks:
|
|
158
|
+
|
|
159
|
+
1. Check the project has zero console errors. Use `console_status` for counts.
|
|
160
|
+
2. Stop there unless the user asked you to prove it works or you suspect a specific fault.
|
|
161
|
+
|
|
162
|
+
If a check fails, go back and reread the [docs pages](#full-topic-map) to find out what you missed.
|
|
163
|
+
|
|
164
|
+
## Final report
|
|
165
|
+
|
|
166
|
+
Give the user a concise but not dense checklist of what you did and why, including any incidental side effects (for example, settings you toggled to test something, or temporary files you created). If the user needs to follow up with more steps or decisions, list them. For example:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
I analyzed the `Rock_01` sprite with the default 75% match threshold:
|
|
170
|
+
|
|
171
|
+
. X X / X * X / X X .
|
|
172
|
+
|
|
173
|
+
[✓] Split the sprite's `rect` into a 3x3 grid.
|
|
174
|
+
[✓] Compared each cell with the center cell's majority color.
|
|
175
|
+
|
|
176
|
+
If you want a stricter or more lenient result, give me a threshold, for example 90% or 50%.
|
|
177
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Full topic map
|
|
2
|
+
|
|
3
|
+
If the Editor install folder has a `Data/Documentation` folder (eg `...Unity/Hub/Editor/6000.6.0b2/Editor/Data/Documentation`), read the html files from the `en/Manual` folder.
|
|
4
|
+
|
|
5
|
+
Otherwise the docs pages are online at `https://docs.unity.com/en-us/engine/<VERSION>/manual/`. Prefer fetching the page directly (for example `WebFetch`) over searching (for example `WebSearch`) — faster and lands on the exact reference. Only fetch what you need, and only search if you don't have the exact URL. Replace `<VERSION>` with the following before fetching:
|
|
6
|
+
|
|
7
|
+
- **docs.unity3d.com**: The Unity version, eg `6000.6`
|
|
8
|
+
- **Package on docs.unity3d.com**: The package version, eg `@6.6` or `@2.0`. Check the package version if unsure.
|
|
9
|
+
- **Engine on docs.unity.com**: The Unity version, eg `6000.3`
|
|
10
|
+
- **docs.unity.com**: The product version, eg `7000.0`
|
|
11
|
+
|
|
12
|
+
For these Engine pages, `<VERSION>` is the Unity major.minor from `ProjectSettings/ProjectVersion.txt`, for example `6000.0` from `6000.0.58f1`, because the full build number gives a 404.
|
|
13
|
+
|
|
14
|
+
Before fetching, check that `<VERSION>` is listed as a `## Version` heading in https://docs.unity.com/en-us/engine/llms.txt. If it isn't, use the docs.unity3d.com Manual instead. The two sites use different page names, so don't reuse the paths below. Instead, find each page by its title in `https://docs.unity3d.com/<VERSION>/Documentation/Manual/docdata/toc.js`, then fetch `https://docs.unity3d.com/<VERSION>/Documentation/Manual/<link>.html`, where `<link>` is the `link` value next to the title.
|
|
15
|
+
|
|
16
|
+
- [Import a sprite or spritesheet texture](https://docs.unity.com/en-us/engine/<VERSION>/manual/unity2d/sprite/import-images-sprites.md) — local `sprite/import-images-sprites/import-images-sprites-landing.html`: setting a texture's type to Sprite (2D and UI).
|
|
17
|
+
- [Cut out sprites from a texture](https://docs.unity.com/en-us/engine/<VERSION>/manual/unity2d/sprite/use-editor.md) — local `sprite/sprite-editor/use-editor.html`: how the Sprite Editor defines each sprite's rectangle.
|
|
18
|
+
- [Sprite asset reference](https://docs.unity.com/en-us/engine/<VERSION>/manual/unity2d/sprite/class-sprite.md) — local `class-Sprite.html`: the properties of a sprite asset in the Inspector.
|
|
19
|
+
- [Sprite (2D and UI) texture Import Settings window reference](https://docs.unity.com/en-us/engine/<VERSION>/manual/materials-and-shaders/textures/textures-reference/texture-type-sprite.md) — local `texture-type-sprite.html`: sprite texture import settings, including Read/Write access.
|
|
20
|
+
|
|
21
|
+
## API reference
|
|
22
|
+
|
|
23
|
+
The API is `UnityEngine.Sprite` (`rect`, `texture`) and `UnityEngine.Texture2D` (`GetPixel`), part of the Unity Engine. It is versioned by Unity version, so check the project's Unity version before relying on a specific class or method.
|
|
24
|
+
|
|
25
|
+
1. Use the `unity-cli` skill to check the project's Unity version.
|
|
26
|
+
2. If the Editor install folder has a `Data/Documentation` folder (e.g. `.../Unity/Hub/Editor/6000.6.0b2/Editor/Data/Documentation`), grep the html files in the `en/ScriptReference` folder inside, and skip the remaining steps.
|
|
27
|
+
3. Otherwise, fetch and cache `https://docs.unity3d.com/<VERSION>/Documentation/ScriptReference/xrefmap.yml` (replace `<VERSION>` with the Unity version, e.g. `6000.3`). This file lists every public API member's fully qualified name as a `uid` (e.g. `uid: 'UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3)'`).
|
|
28
|
+
4. Grep the yml file locally for a class or method instead of refetching per lookup. The file is large (about 6 MB), so don't read the whole file.
|
|
29
|
+
5. Convert the `uid` to a markdown page: remove the parameters in brackets, lowercase it, replace `.` with `/`, and add `.md`. Then fetch `https://docs.unity.com/en-us/engine/<VERSION>/script-reference/<converted uid>`. For example, `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3)` => `https://docs.unity.com/en-us/engine/<VERSION>/script-reference/unityengine/rigidbody/addforce.md`. All overloads are on the same page.
|
|
30
|
+
- Constructors use `ctor` (e.g. `unityengine/vector3/ctor.md`), and indexers use `item` (e.g. `unityengine/vector3/item.md`).
|
|
31
|
+
- For operators, fetch the class page (e.g. `unityengine/vector3.md`) and follow its link.
|
|
32
|
+
- Links inside the pages start with `/engine/`. Add `https://docs.unity.com/en-us` before them.
|
|
33
|
+
- If the page doesn't exist for that Unity version, use the `href` in the `xrefmap.yml` entry instead (e.g. `href: 'Rigidbody.AddForce.html'` => `https://docs.unity3d.com/<VERSION>/Documentation/ScriptReference/Rigidbody.AddForce.html`).
|
|
34
|
+
|
|
35
|
+
On Unity versions earlier than 6000.0, which have no `xrefmap.yml`, skip steps 3 to 5 and fetch the class or member page directly, for example `https://docs.unity3d.com/<VERSION>/Documentation/ScriptReference/Sprite-rect.html`.
|
|
36
|
+
|
|
37
|
+
Always use the docs for the project's Unity version rather than relying on training knowledge, since APIs are frequently marked obsolete between versions.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Code template for analyzing Sprite textures as a 3x3 color grid.
|
|
2
|
+
// Segments a Sprite into a 3x3 grid and outputs a text pattern based on
|
|
3
|
+
// color matching with the center cell.
|
|
4
|
+
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace SpriteGridAnalysis
|
|
10
|
+
{
|
|
11
|
+
public static class SpriteGridAnalysis
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Analyzes a sprite and returns a 3x3 grid pattern based on color matching.
|
|
15
|
+
/// </summary>
|
|
16
|
+
/// <param name="sprite">The sprite to analyze</param>
|
|
17
|
+
/// <param name="matchThreshold">Percentage of pixels that must match center color (0.5 = 50%, 0.75 = 75%, 0.9 = 90%)</param>
|
|
18
|
+
/// <param name="colorTolerance">RGB tolerance for considering two colors as matching</param>
|
|
19
|
+
public static string AnalyzeSpriteGrid(Sprite sprite, float matchThreshold = 0.5f, float colorTolerance = 0.04f)
|
|
20
|
+
{
|
|
21
|
+
var texture = sprite.texture;
|
|
22
|
+
var rect = sprite.rect;
|
|
23
|
+
|
|
24
|
+
int cellWidth = (int)(rect.width / 3);
|
|
25
|
+
int cellHeight = (int)(rect.height / 3);
|
|
26
|
+
|
|
27
|
+
// Get center cell bounds (row 1, col 1)
|
|
28
|
+
int centerStartX = (int)rect.x + cellWidth;
|
|
29
|
+
int centerStartY = (int)rect.y + cellHeight;
|
|
30
|
+
Color centerColor = GetMajorityColor(texture, centerStartX, centerStartY, cellWidth, cellHeight);
|
|
31
|
+
|
|
32
|
+
// Build output by checking each cell against center color
|
|
33
|
+
var symbols = new string[9];
|
|
34
|
+
for (int row = 0; row < 3; row++)
|
|
35
|
+
{
|
|
36
|
+
for (int col = 0; col < 3; col++)
|
|
37
|
+
{
|
|
38
|
+
int cellIndex = row * 3 + col;
|
|
39
|
+
|
|
40
|
+
if (cellIndex == 4)
|
|
41
|
+
{
|
|
42
|
+
symbols[cellIndex] = "*";
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
int startX = (int)rect.x + col * cellWidth;
|
|
47
|
+
int startY = (int)rect.y + (2 - row) * cellHeight; // Flip Y for top-to-bottom
|
|
48
|
+
float matchPercentage = GetColorMatchPercentage(texture, startX, startY, cellWidth, cellHeight, centerColor, colorTolerance);
|
|
49
|
+
|
|
50
|
+
symbols[cellIndex] = matchPercentage >= matchThreshold ? "." : "X";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Format: "A B C / D E F / G H I"
|
|
55
|
+
return $"{symbols[0]} {symbols[1]} {symbols[2]} / {symbols[3]} {symbols[4]} {symbols[5]} / {symbols[6]} {symbols[7]} {symbols[8]}";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// Gets the majority (most frequent) color in a cell region.
|
|
60
|
+
/// </summary>
|
|
61
|
+
static Color GetMajorityColor(Texture2D texture, int startX, int startY, int width, int height)
|
|
62
|
+
{
|
|
63
|
+
var colorCounts = new Dictionary<Color32, int>();
|
|
64
|
+
|
|
65
|
+
for (int y = startY; y < startY + height; y++)
|
|
66
|
+
{
|
|
67
|
+
for (int x = startX; x < startX + width; x++)
|
|
68
|
+
{
|
|
69
|
+
Color32 pixel = texture.GetPixel(x, y);
|
|
70
|
+
if (!colorCounts.ContainsKey(pixel))
|
|
71
|
+
colorCounts[pixel] = 0;
|
|
72
|
+
colorCounts[pixel]++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return colorCounts.OrderByDescending(kvp => kvp.Value).First().Key;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
/// Calculates what percentage of pixels in a cell match the target color.
|
|
81
|
+
/// </summary>
|
|
82
|
+
static float GetColorMatchPercentage(Texture2D texture, int startX, int startY, int width, int height, Color targetColor, float colorTolerance)
|
|
83
|
+
{
|
|
84
|
+
int totalPixels = 0;
|
|
85
|
+
int matchingPixels = 0;
|
|
86
|
+
|
|
87
|
+
for (int y = startY; y < startY + height; y++)
|
|
88
|
+
{
|
|
89
|
+
for (int x = startX; x < startX + width; x++)
|
|
90
|
+
{
|
|
91
|
+
totalPixels++;
|
|
92
|
+
Color pixel = texture.GetPixel(x, y);
|
|
93
|
+
if (ColorsMatch(pixel, targetColor, colorTolerance))
|
|
94
|
+
matchingPixels++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return totalPixels > 0 ? (float)matchingPixels / totalPixels : 0f;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static bool ColorsMatch(Color a, Color b, float tolerance)
|
|
102
|
+
{
|
|
103
|
+
return Mathf.Abs(a.r - b.r) < tolerance &&
|
|
104
|
+
Mathf.Abs(a.g - b.g) < tolerance &&
|
|
105
|
+
Mathf.Abs(a.b - b.b) < tolerance;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Usage Examples:
|
|
111
|
+
//
|
|
112
|
+
// // Default 50% threshold
|
|
113
|
+
// string pattern1 = SpriteGridAnalysis.SpriteGridAnalysis.AnalyzeSpriteGrid(mySprite);
|
|
114
|
+
//
|
|
115
|
+
// // Strict 90% threshold
|
|
116
|
+
// string pattern2 = SpriteGridAnalysis.SpriteGridAnalysis.AnalyzeSpriteGrid(mySprite, matchThreshold: 0.9f);
|
|
117
|
+
//
|
|
118
|
+
// // 75% threshold with tighter color tolerance
|
|
119
|
+
// string pattern3 = SpriteGridAnalysis.SpriteGridAnalysis.AnalyzeSpriteGrid(mySprite, matchThreshold: 0.75f, colorTolerance: 0.02f);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui
|
|
3
|
+
description: Routes Unity UI requests to the right framework skill (UI Toolkit, uGUI, or IMGUI) and answers UI comparison questions. Use for menus, HUDs, panels, or editor UI when the request doesn't name a framework. Consult before writing any UI code.
|
|
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
|