@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,61 @@
|
|
|
1
|
+
# Complete Workflow
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
User Request
|
|
5
|
+
↓
|
|
6
|
+
Step 0: Check for existing scripts with [UNITY-SKILL:SPRITEATLAS] identifier
|
|
7
|
+
↓
|
|
8
|
+
├─ Found existing scripts?
|
|
9
|
+
│ ↓ YES
|
|
10
|
+
│ Ask user: Update existing / Create new / Abort
|
|
11
|
+
│ ↓
|
|
12
|
+
│ Handle user choice
|
|
13
|
+
│
|
|
14
|
+
└─ NO existing scripts or user chose "Create new"
|
|
15
|
+
↓
|
|
16
|
+
Ask "Built-in data or Addressables?"
|
|
17
|
+
↓
|
|
18
|
+
├─ Option A: Built-in
|
|
19
|
+
│ ↓
|
|
20
|
+
│ Generate 1 script: Prebuild generator (includeInBuild=true)
|
|
21
|
+
│
|
|
22
|
+
└─ Option B: Addressables
|
|
23
|
+
↓
|
|
24
|
+
Generate 3 scripts:
|
|
25
|
+
1. Prebuild: Generate atlases + create Addressables entries (includeInBuild=false)
|
|
26
|
+
2. Postprocess: Build Addressables bundles
|
|
27
|
+
3. Runtime: Late-binding loader component
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Step 3: Customize Categorization Rules**
|
|
31
|
+
|
|
32
|
+
Edit the `OnPreprocessBuild` method to match your project's sprite organization. Choose one or combine multiple strategies:
|
|
33
|
+
|
|
34
|
+
| Strategy | When to Use | Implementation |
|
|
35
|
+
|----------|-------------|----------------|
|
|
36
|
+
| **Folder-based** | Sprites organized by folder structure | `GenerateAtlasByFolder("Assets/Art/UI", "Assets/Atlases/UI.spriteatlasv2")` |
|
|
37
|
+
| **Naming convention** | Sprites follow naming patterns | `GenerateAtlasByNaming("Assets/Art", "icon_", "Assets/Atlases/Icons.spriteatlasv2")` |
|
|
38
|
+
| **Asset labels** | Sprites tagged with labels |
|
|
39
|
+
| **Scene-based** | Sprites used in specific scenes | Query scene references |
|
|
40
|
+
|
|
41
|
+
**Step 4: Build Your Project**
|
|
42
|
+
|
|
43
|
+
Atlases are automatically generated/updated during build. **No manual menu clicks required.** This is why prebuild is the default approach.
|
|
44
|
+
|
|
45
|
+
**For Built-in Data (Option A):**
|
|
46
|
+
- Atlases are included in build
|
|
47
|
+
- Ready for immediate use at runtime
|
|
48
|
+
|
|
49
|
+
**For Addressables (Option B) - Additional Required Steps:**
|
|
50
|
+
|
|
51
|
+
You MUST generate THREE scripts (not just one):
|
|
52
|
+
|
|
53
|
+
1. **Prebuild script** (IPreprocessBuildWithReport) - Generates atlases and creates Addressables entries automatically
|
|
54
|
+
2. **Build Addressables script** (IPostprocessBuildWithReport) - Builds Addressables content bundles
|
|
55
|
+
3. **Late-binding runtime loader** (MonoBehaviour) - Handles on-demand loading via SpriteAtlasManager
|
|
56
|
+
|
|
57
|
+
The build process will:
|
|
58
|
+
- Generate atlases (prebuild step)
|
|
59
|
+
- Create addressable entries automatically
|
|
60
|
+
- Build addressables content bundles (postprocess step)
|
|
61
|
+
- At runtime: Late-binding loader automatically loads atlases when sprites are first accessed
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Custom Sprite Packing with ScriptablePacker
|
|
2
|
+
|
|
3
|
+
Guide for implementing custom sprite packing algorithms in SpriteAtlas V2.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Use Cases](#use-cases)
|
|
9
|
+
- [ScriptablePacker API](#scriptablepacker-api)
|
|
10
|
+
- [Abstract Methods](#abstract-methods)
|
|
11
|
+
- [PackerData Structure](#packerdata-structure)
|
|
12
|
+
- [SpriteData Structure](#spritedata-structure)
|
|
13
|
+
- [SpritePack Output Structure](#spritepack-output-structure)
|
|
14
|
+
- [TextureData Structure](#texturedata-structure)
|
|
15
|
+
- [PackTransform Options](#packtransform-options)
|
|
16
|
+
- [Example: Grid-Based Packer](#example-grid-based-packer)
|
|
17
|
+
- [Example: Multi-Page Packer](#example-multi-page-packer)
|
|
18
|
+
- [Example: Size-Optimized Packer](#example-size-optimized-packer)
|
|
19
|
+
- [Assigning Custom Packer to Atlas](#assigning-custom-packer-to-atlas)
|
|
20
|
+
- [Best Practices](#best-practices)
|
|
21
|
+
- [Performance](#performance)
|
|
22
|
+
- [Correctness](#correctness)
|
|
23
|
+
- [Maintainability](#maintainability)
|
|
24
|
+
- [Common Pitfalls](#common-pitfalls)
|
|
25
|
+
- [Debugging Tips](#debugging-tips)
|
|
26
|
+
|
|
27
|
+
## Overview
|
|
28
|
+
|
|
29
|
+
`ScriptablePacker` is an abstract base class for creating custom packing algorithms. Extend it to implement specialized packing strategies beyond Unity's default algorithms.
|
|
30
|
+
|
|
31
|
+
**Namespace:** `UnityEditor.U2D`
|
|
32
|
+
**Location:** `SpriteAtlasAsset.bindings.cs`
|
|
33
|
+
|
|
34
|
+
## Use Cases
|
|
35
|
+
|
|
36
|
+
Custom packers are useful for:
|
|
37
|
+
- Non-standard sprite arrangements (circular, grid-based, specific patterns)
|
|
38
|
+
- Multi-page atlas generation with custom page selection
|
|
39
|
+
- Sprite preprocessing and optimization before packing
|
|
40
|
+
- Platform-specific packing strategies
|
|
41
|
+
- Domain-specific packing requirements (UI layouts, sprite sheets)
|
|
42
|
+
|
|
43
|
+
## ScriptablePacker API
|
|
44
|
+
|
|
45
|
+
### Abstract Methods
|
|
46
|
+
|
|
47
|
+
See [resources/scriptablepacker.cs](../resources/scriptablepacker.cs).
|
|
48
|
+
|
|
49
|
+
### PackerData Structure
|
|
50
|
+
|
|
51
|
+
Contains all input data for packing:
|
|
52
|
+
|
|
53
|
+
```csharp
|
|
54
|
+
struct PackerData
|
|
55
|
+
{
|
|
56
|
+
NativeArray<Color32> colorData; // Pixel data from source textures
|
|
57
|
+
NativeArray<SpriteData> spriteData; // Sprite information
|
|
58
|
+
NativeArray<TextureData> textureData; // Texture dimensions
|
|
59
|
+
NativeArray<int> indexData; // Sprite mesh indices
|
|
60
|
+
NativeArray<Vector2> vertexData; // Sprite mesh vertices
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Important:** Do NOT dispose these arrays - they're managed externally by Unity.
|
|
65
|
+
|
|
66
|
+
### SpriteData Structure
|
|
67
|
+
|
|
68
|
+
Information about each sprite:
|
|
69
|
+
|
|
70
|
+
See [resources/spritedata.cs](../resources/spritedata.cs).
|
|
71
|
+
|
|
72
|
+
### SpritePack Output Structure
|
|
73
|
+
|
|
74
|
+
Set this on each `SpriteData` to specify packing result:
|
|
75
|
+
|
|
76
|
+
See [resources/spritepack.cs](../resources/spritepack.cs).
|
|
77
|
+
|
|
78
|
+
### TextureData Structure
|
|
79
|
+
|
|
80
|
+
Source texture information:
|
|
81
|
+
|
|
82
|
+
See [resources/texturedata.cs](../resources/texturedata.cs).
|
|
83
|
+
|
|
84
|
+
### PackTransform Options
|
|
85
|
+
|
|
86
|
+
Sprite transformations during packing:
|
|
87
|
+
|
|
88
|
+
See [resources/packtransform.cs](../resources/packtransform.cs).
|
|
89
|
+
|
|
90
|
+
## Example: Grid-Based Packer
|
|
91
|
+
|
|
92
|
+
Simple example that arranges sprites in a grid pattern.
|
|
93
|
+
|
|
94
|
+
See [resources/gridspritepacker.cs](../resources/gridspritepacker.cs).
|
|
95
|
+
|
|
96
|
+
## Example: Multi-Page Packer
|
|
97
|
+
|
|
98
|
+
Distributes sprites across multiple atlas pages.
|
|
99
|
+
|
|
100
|
+
See [resources/multipagepacker.cs](../resources/multipagepacker.cs).
|
|
101
|
+
|
|
102
|
+
## Example: Size-Optimized Packer
|
|
103
|
+
|
|
104
|
+
Packs larger sprites first for better space utilization.
|
|
105
|
+
|
|
106
|
+
See [resources/sizeoptimizedpacker.cs](../resources/sizeoptimizedpacker.cs).
|
|
107
|
+
|
|
108
|
+
## Assigning Custom Packer to Atlas
|
|
109
|
+
|
|
110
|
+
Use `SpriteAtlasAsset.SetScriptablePacker()` to assign your custom packer.
|
|
111
|
+
|
|
112
|
+
See [resources/custompackersetup.cs](../resources/custompackersetup.cs).
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
### Performance
|
|
117
|
+
|
|
118
|
+
1. **Minimize array access**: Cache NativeArray values when accessing multiple times
|
|
119
|
+
2. **Avoid allocations**: Don't create new arrays or collections in hot paths
|
|
120
|
+
3. **Use simple algorithms**: Complex packing algorithms can slow down import times
|
|
121
|
+
|
|
122
|
+
### Correctness
|
|
123
|
+
|
|
124
|
+
1. **Don't dispose input arrays**: Unity manages these - don't dispose them
|
|
125
|
+
2. **Validate output bounds**: Ensure sprites fit within atlas dimensions
|
|
126
|
+
3. **Handle edge cases**: Empty sprite lists, oversized sprites, etc.
|
|
127
|
+
4. **Return false on failure**: Let Unity know packing failed
|
|
128
|
+
|
|
129
|
+
### Maintainability
|
|
130
|
+
|
|
131
|
+
1. **Make packer configurable**: Add public properties for tweaking behavior
|
|
132
|
+
2. **Add debug logging**: Log packing statistics and warnings
|
|
133
|
+
3. **Document algorithm**: Explain packing strategy in comments
|
|
134
|
+
4. **Test with various inputs**: Different sprite sizes, counts, and arrangements
|
|
135
|
+
|
|
136
|
+
## Common Pitfalls
|
|
137
|
+
|
|
138
|
+
1. **Disposing input arrays**: Unity manages these - don't dispose them
|
|
139
|
+
2. **Forgetting to set `sprite.output`**: Each sprite needs output position
|
|
140
|
+
3. **Exceeding atlas bounds**: Validate that packed sprites fit within max texture size
|
|
141
|
+
4. **Not handling multi-page**: Set `sprite.output.page` correctly for multi-page atlases
|
|
142
|
+
5. **Modifying read-only fields**: Some fields like texture dimensions are read-only
|
|
143
|
+
6. **Forgetting to assign packer**: Use `SetScriptablePacker()` before saving atlas
|
|
144
|
+
|
|
145
|
+
## Debugging Tips
|
|
146
|
+
|
|
147
|
+
See [resources/packerdebugging.cs](../resources/packerdebugging.cs).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 1. Delivery Mechanism (REQUIRED)
|
|
2
|
+
|
|
3
|
+
Ask: "How do you want to deliver the sprite atlases?"
|
|
4
|
+
|
|
5
|
+
**Option A: Built-in Data (Immediate Loading)**
|
|
6
|
+
- Atlases are included in the build and loaded immediately
|
|
7
|
+
- Set `includeInBuild = true`
|
|
8
|
+
- **Suitable for**: Core UI, main gameplay sprites, always-needed assets
|
|
9
|
+
- **Pros**: Simple, no additional packages, instant access
|
|
10
|
+
- **Cons**: Increases initial build size, cannot update without new build
|
|
11
|
+
|
|
12
|
+
**Option B: Late-Binding via Addressables (On-Demand Loading)**
|
|
13
|
+
- Atlases are NOT included in build, loaded on-demand via Addressables
|
|
14
|
+
- Set `includeInBuild = false`
|
|
15
|
+
- Create Addressables entries for each atlas
|
|
16
|
+
- Add addressable setup as prebuild step
|
|
17
|
+
- **🚨 REQUIRED**: Build Addressables content as build step
|
|
18
|
+
- **🚨 REQUIRED**: Create late-binding runtime loader script
|
|
19
|
+
- **Suitable for**: DLC content, optional features, large assets, downloadable content
|
|
20
|
+
- **Pros**: Smaller initial build, can update independently, on-demand loading
|
|
21
|
+
- **Cons**: Requires Addressables package, async loading, network dependency
|
|
22
|
+
|
|
23
|
+
| Use Case | Recommended |
|
|
24
|
+
|----------|-------------|
|
|
25
|
+
| Core UI sprites that are always visible | **Option A: Built-in** |
|
|
26
|
+
| Tutorial or onboarding sprites | **Option A: Built-in** |
|
|
27
|
+
| Level-specific sprites (100+ levels) | **Option B: Addressables** |
|
|
28
|
+
| DLC or seasonal content | **Option B: Addressables** |
|
|
29
|
+
| Localized UI sprites (multiple languages) | **Option B: Addressables** |
|
|
30
|
+
| Character skins or cosmetics | **Option B: Addressables** |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Key Requirements (V2-Specific)
|
|
2
|
+
|
|
3
|
+
1. **🚨 ALWAYS check for existing scripts FIRST**: Before generating code, scan for scripts with `[UNITY-SKILL:SPRITEATLAS]` identifier and prompt user to update or create new
|
|
4
|
+
2. **🚨 ALWAYS tag generated scripts**: Include skill identifier at the top of every generated script for future detection
|
|
5
|
+
3. **🚨 ALWAYS ask for delivery mechanism**: Ask user "Built-in data or Addressables?" before generating code
|
|
6
|
+
4. **🚨 ALWAYS enable Sprite Packer mode**: Set `EditorSettings.spritePackerMode = SpritePackerMode.SpriteAtlasV2` in prebuild script
|
|
7
|
+
5. **🚨 ALWAYS use prebuild generation**: Implement `IPreprocessBuildWithReport` as the DEFAULT approach for creating atlases
|
|
8
|
+
6. **🚨 ONLY add sprites from Assets/ folder**: Never add sprites from Packages, built-in assets, or external locations
|
|
9
|
+
7. **🚨 For Addressables delivery, ALWAYS generate THREE scripts**:
|
|
10
|
+
- Prebuild atlas generator with Addressables setup
|
|
11
|
+
- `IPostprocessBuildWithReport` to build Addressables content
|
|
12
|
+
- Late-binding runtime loader script (extends `SpriteAtlasManager`)
|
|
13
|
+
8. **Set includeInBuild correctly**: `true` for built-in data, `false` for Addressables
|
|
14
|
+
9. **Two-Step Editor Pattern**: Create with `SpriteAtlasAsset` → Save → Import → Configure via `SpriteAtlasImporter` → SaveAndReimport()
|
|
15
|
+
10. **Never use `SpriteAtlas` in editor code** — except `SpriteAtlas.GetPackables()` instance method on a loaded runtime atlas
|
|
16
|
+
11. **Variants reference master**: Use `SetMasterAtlas(SpriteAtlas)` with runtime instance loaded via `AssetDatabase.LoadAssetAtPath<SpriteAtlas>()`
|
|
17
|
+
12. **Platform format assignment**: Use `format = TextureImporterFormat.ASTC_6x6` directly (no cast)
|
|
18
|
+
13. **File extension**: V2 atlases use `.spriteatlasv2` (not `.spriteatlas`)
|
|
19
|
+
14. **`SpriteAtlasUtility.PackAtlases()` is optional**: Only for editor preview; build-time packing is automatic
|
|
20
|
+
|
|
21
|
+
For common errors and invalid patterns, see [references/common-errors.md](common-errors.md).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Manual Authoring (Advanced - Not Default)
|
|
2
|
+
|
|
3
|
+
> ⚠ **WARNING**: Manual authoring is NOT the default approach. Only use these patterns when the user EXPLICITLY requests manual control or editor preview during development.
|
|
4
|
+
|
|
5
|
+
> 🚨 **DEFAULT APPROACH**: Use prebuild generation with `IPreprocessBuildWithReport` instead. See the main SKILL.md Quick Start section.
|
|
6
|
+
|
|
7
|
+
## When to Use Manual Authoring
|
|
8
|
+
|
|
9
|
+
**Manual authoring is appropriate ONLY for:**
|
|
10
|
+
- Hand-optimized sprite layouts where exact positioning matters
|
|
11
|
+
- Custom sprite ordering requirements
|
|
12
|
+
- Editor preview during authoring workflow
|
|
13
|
+
- Explicitly requested by user
|
|
14
|
+
|
|
15
|
+
**DO NOT use manual authoring when:**
|
|
16
|
+
- User asks to "create sprite atlas" (use prebuild)
|
|
17
|
+
- User asks to "optimize sprites" (use prebuild)
|
|
18
|
+
- User asks for automated workflow (use prebuild)
|
|
19
|
+
- No specific manual control requirement mentioned
|
|
20
|
+
|
|
21
|
+
## Create and Configure Master Atlas (Manual Pattern)
|
|
22
|
+
|
|
23
|
+
> 🚨 **REMINDER**: Only use this if explicitly requested. Default is prebuild with `IPreprocessBuildWithReport`.
|
|
24
|
+
|
|
25
|
+
See [resources/createandconfiguremasteratlas.cs](../resources/createandconfiguremasteratlas.cs).
|
|
26
|
+
|
|
27
|
+
## Create Variant Atlas (Manual Pattern)
|
|
28
|
+
|
|
29
|
+
> 🚨 **REMINDER**: Only use this if explicitly requested. Default is prebuild with `IPreprocessBuildWithReport`.
|
|
30
|
+
|
|
31
|
+
See [resources/variantatlas.cs](../resources/variantatlas.cs).
|
|
32
|
+
|
|
33
|
+
## Runtime Dynamic Loading
|
|
34
|
+
|
|
35
|
+
See [resources/runtimeatlasloader.cs](../resources/runtimeatlasloader.cs).
|
|
36
|
+
|
|
37
|
+
## Runtime Sprite Access
|
|
38
|
+
|
|
39
|
+
See [resources/runtimespriteaccess.cs](../resources/runtimespriteaccess.cs).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Namespaces
|
|
2
|
+
|
|
3
|
+
**Editor Scripts:**
|
|
4
|
+
```csharp
|
|
5
|
+
using UnityEditor; // AssetImporter, AssetDatabase
|
|
6
|
+
using UnityEditor.U2D; // SpriteAtlasAsset, SpriteAtlasImporter, SpriteAtlasUtility
|
|
7
|
+
using UnityEngine; // Runtime types (e.g., TextureImporterFormat)
|
|
8
|
+
using UnityEngine.U2D; // SpriteAtlas
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Runtime Scripts:**
|
|
12
|
+
```csharp
|
|
13
|
+
using UnityEngine; // Core Unity types
|
|
14
|
+
using UnityEngine.U2D; // SpriteAtlas, SpriteAtlasManager
|
|
15
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Critical V2 Architecture
|
|
2
|
+
|
|
3
|
+
| Context | Component | Purpose | Allowed Usage |
|
|
4
|
+
|---------|-----------|---------|---------------|
|
|
5
|
+
| **Editor Authoring** | `SpriteAtlasAsset` | Add/remove sprites/folders; store metadata | ✅ Editor scripts only |
|
|
6
|
+
| **Editor Settings** | `SpriteAtlasImporter` | Configure texture, packing, platform settings | ✅ Editor scripts only |
|
|
7
|
+
| **Editor Packing** | `SpriteAtlasUtility.PackAtlases()` | *Optional* editor preview packing (not for build) | ⚠ Only for preview; atlases auto-pack at build |
|
|
8
|
+
| **Runtime** | `SpriteAtlas` | Query packed sprites (read-only) | ✅ Runtime scripts only |
|
|
9
|
+
| **Runtime Loading** | `SpriteAtlasManager` | Dynamic loading callbacks | ✅ Runtime scripts only |
|
|
10
|
+
|
|
11
|
+
## Forbidden Cross-Context Usage (Common Error Sources)
|
|
12
|
+
|
|
13
|
+
| ❌ Invalid Pattern | ✅ Correct Pattern |
|
|
14
|
+
|--------------------|-------------------|
|
|
15
|
+
| `new SpriteAtlas()` in editor code | Use `SpriteAtlasAsset` + `SpriteAtlasImporter` |
|
|
16
|
+
| `AssetDatabase.LoadAssetAtPath<SpriteAtlas>(...)` in editor | Use `SpriteAtlasAsset.Load(...)` |
|
|
17
|
+
| `SpriteAtlasAsset.GetPackables()` in editor | Use `SpriteAtlas.GetPackables()` |
|
|
18
|
+
| Modifying `SpriteAtlas` in editor scripts | Modify `SpriteAtlasAsset` → reimport → use `SpriteAtlasImporter` |
|
|
19
|
+
| Create variants from original packable objects (sprites/folders) | Creating variants from a Master runtime `SpriteAtlas` |
|
|
20
|
+
|
|
21
|
+
**NEVER script against `SpriteAtlas` in editor code** — it is *only* for runtime use in V2 except for GetPackables.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.U2D;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Explains the critical distinction between editor authoring and runtime access.
|
|
9
|
+
/// SpriteAtlasAsset (editor) vs SpriteAtlas (runtime) - never mix them!
|
|
10
|
+
/// </summary>
|
|
11
|
+
public static class AuthoringVsRuntimeDocumentation
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// SPRITEATLASASSET - Editor-Only Type
|
|
15
|
+
/// Used for creating, modifying, and configuring atlases in the editor.
|
|
16
|
+
/// Cannot be used at runtime.
|
|
17
|
+
/// </summary>
|
|
18
|
+
public static void Use_SpriteAtlasAsset_Editor()
|
|
19
|
+
{
|
|
20
|
+
// ✅ CORRECT: Using SpriteAtlasAsset in editor code
|
|
21
|
+
|
|
22
|
+
// Create new atlas asset
|
|
23
|
+
SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
24
|
+
|
|
25
|
+
// Add sprites for authoring
|
|
26
|
+
Object[] sprites = AssetDatabase.LoadAllAssetsAtPath("Assets/Sprites/mySprite.png");
|
|
27
|
+
asset.Add(sprites);
|
|
28
|
+
|
|
29
|
+
// Save to disk
|
|
30
|
+
SpriteAtlasAsset.Save(asset, "Assets/MyAtlas.spriteatlasv2");
|
|
31
|
+
|
|
32
|
+
// Configure via importer (editor-only)
|
|
33
|
+
AssetDatabase.ImportAsset("Assets/MyAtlas.spriteatlasv2");
|
|
34
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath("Assets/MyAtlas.spriteatlasv2") as SpriteAtlasImporter;
|
|
35
|
+
importer.includeInBuild = true;
|
|
36
|
+
importer.SaveAndReimport();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// SPRITEATLAS - Runtime-Only Type
|
|
41
|
+
/// Used for querying packed sprites at runtime.
|
|
42
|
+
/// Cannot be created or modified in editor code.
|
|
43
|
+
/// </summary>
|
|
44
|
+
public static void Use_SpriteAtlas_Runtime()
|
|
45
|
+
{
|
|
46
|
+
// ✅ CORRECT: Using SpriteAtlas at runtime
|
|
47
|
+
|
|
48
|
+
// Register for late-binding to load atlases on-demand
|
|
49
|
+
SpriteAtlasManager.atlasRegistered += OnAtlasLoaded;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private static void OnAtlasLoaded(SpriteAtlas atlas)
|
|
53
|
+
{
|
|
54
|
+
// Query sprites from loaded atlas (runtime only)
|
|
55
|
+
Object[] packables = atlas.GetPackables();
|
|
56
|
+
// ... use sprites ...
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// ❌ WRONG: Using SpriteAtlas in editor code.
|
|
61
|
+
/// SpriteAtlas is a runtime type and cannot be constructed in editor.
|
|
62
|
+
/// </summary>
|
|
63
|
+
public static void Wrong_UseSpriteAtlasInEditor()
|
|
64
|
+
{
|
|
65
|
+
// ❌ WRONG: Cannot construct SpriteAtlas in editor
|
|
66
|
+
// SpriteAtlas atlas = new SpriteAtlas(); // Compile error!
|
|
67
|
+
|
|
68
|
+
// ❌ WRONG: Cannot load SpriteAtlas in editor
|
|
69
|
+
// SpriteAtlas atlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>("path"); // Runtime error!
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// ❌ WRONG: Using SpriteAtlasAsset at runtime.
|
|
74
|
+
/// SpriteAtlasAsset is an asset file, not a runtime object.
|
|
75
|
+
/// </summary>
|
|
76
|
+
public static void Wrong_UseSpriteAtlasAssetRuntime()
|
|
77
|
+
{
|
|
78
|
+
// ❌ WRONG: Cannot use SpriteAtlasAsset in runtime code
|
|
79
|
+
// SpriteAtlasAsset asset = someReference; // This is an editor type!
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// <summary>
|
|
83
|
+
/// ✅ CORRECT: Two-step V2 pattern for atlas creation.
|
|
84
|
+
/// Step 1: Create with SpriteAtlasAsset (editor)
|
|
85
|
+
/// Step 2: Use at runtime via SpriteAtlas
|
|
86
|
+
/// </summary>
|
|
87
|
+
public static void Correct_TwoStepPattern()
|
|
88
|
+
{
|
|
89
|
+
// ===== STEP 1: EDITOR AUTHORING (SpriteAtlasAsset) =====
|
|
90
|
+
|
|
91
|
+
// In editor script or prebuild processor:
|
|
92
|
+
SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
93
|
+
asset.Add(AssetDatabase.LoadAllAssetsAtPath("Assets/Sprites/mySprite.png"));
|
|
94
|
+
SpriteAtlasAsset.Save(asset, "Assets/MyAtlas.spriteatlasv2");
|
|
95
|
+
AssetDatabase.ImportAsset("Assets/MyAtlas.spriteatlasv2");
|
|
96
|
+
|
|
97
|
+
// Configure via importer
|
|
98
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath("Assets/MyAtlas.spriteatlasv2") as SpriteAtlasImporter;
|
|
99
|
+
importer.includeInBuild = true; // Include in build for immediate loading
|
|
100
|
+
importer.SaveAndReimport();
|
|
101
|
+
|
|
102
|
+
// ===== STEP 2: RUNTIME ACCESS (SpriteAtlas) =====
|
|
103
|
+
|
|
104
|
+
// In runtime script:
|
|
105
|
+
/*
|
|
106
|
+
public class MyRuntimeScript : MonoBehaviour
|
|
107
|
+
{
|
|
108
|
+
private void Awake()
|
|
109
|
+
{
|
|
110
|
+
// Register for late-binding if using Addressables
|
|
111
|
+
SpriteAtlasManager.atlasRegistrationNeeded += OnAtlasRegistrationNeeded;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private void OnAtlasRegistrationNeeded(Sprite sprite)
|
|
115
|
+
{
|
|
116
|
+
// Load atlas via Addressables/AssetBundles
|
|
117
|
+
// The loaded SpriteAtlas is what you query at runtime
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
*/
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
/// Summary table of when to use each type:
|
|
125
|
+
///
|
|
126
|
+
/// | Context | Type | Purpose |
|
|
127
|
+
/// |--------------|-------------------|--------------------------------------|
|
|
128
|
+
/// | Editor | SpriteAtlasAsset | Create, modify, configure atlases |
|
|
129
|
+
/// | Editor | SpriteAtlasImporter | Set texture, packing, platform settings |
|
|
130
|
+
/// | Runtime | SpriteAtlas | Query packed sprites (read-only) |
|
|
131
|
+
/// | Runtime | SpriteAtlasManager| Dynamic loading callbacks |
|
|
132
|
+
/// </summary>
|
|
133
|
+
public static void Summary_Table()
|
|
134
|
+
{
|
|
135
|
+
/*
|
|
136
|
+
+------------------+-------------------+--------------------------------------+
|
|
137
|
+
| Context | Type | Purpose |
|
|
138
|
+
+------------------+-------------------+--------------------------------------+
|
|
139
|
+
| Editor | SpriteAtlasAsset | Create, modify, configure atlases |
|
|
140
|
+
| Editor | SpriteAtlasImporter | Set texture, packing, platform settings |
|
|
141
|
+
| Runtime | SpriteAtlas | Query packed sprites (read-only) |
|
|
142
|
+
| Runtime | SpriteAtlasManager| Dynamic loading callbacks |
|
|
143
|
+
+------------------+-------------------+--------------------------------------+
|
|
144
|
+
*/
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// <summary>
|
|
149
|
+
/// Example: Editor script that creates an atlas using the correct types.
|
|
150
|
+
/// </summary>
|
|
151
|
+
public static class CorrectEditorScript
|
|
152
|
+
{
|
|
153
|
+
[MenuItem("Tools/Create Atlas")]
|
|
154
|
+
public static void CreateAtlas()
|
|
155
|
+
{
|
|
156
|
+
// Use SpriteAtlasAsset for editor authoring
|
|
157
|
+
SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
158
|
+
|
|
159
|
+
// Add sprites from a folder
|
|
160
|
+
string[] guids = AssetDatabase.FindAssets("t:Sprite", new[] { "Assets/Sprites" });
|
|
161
|
+
Object[] sprites = new Object[guids.Length];
|
|
162
|
+
for (int i = 0; i < guids.Length; i++)
|
|
163
|
+
{
|
|
164
|
+
sprites[i] = AssetDatabase.LoadAssetAtPath<Sprite>(
|
|
165
|
+
AssetDatabase.GUIDToAssetPath(guids[i]));
|
|
166
|
+
}
|
|
167
|
+
asset.Add(sprites);
|
|
168
|
+
|
|
169
|
+
// Save and import
|
|
170
|
+
string path = "Assets/Atlases/MyAtlas.spriteatlasv2";
|
|
171
|
+
SpriteAtlasAsset.Save(asset, path);
|
|
172
|
+
AssetDatabase.ImportAsset(path);
|
|
173
|
+
|
|
174
|
+
Debug.Log($"Created atlas at {path}");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
// [TYPE:POSTPROCESS-ADDRESSABLES]
|
|
3
|
+
// Generated by SpriteAtlas V2 Skill
|
|
4
|
+
// This script builds Addressables content after atlas generation
|
|
5
|
+
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEditor.Build;
|
|
8
|
+
using UnityEditor.Build.Reporting;
|
|
9
|
+
using UnityEngine;
|
|
10
|
+
|
|
11
|
+
#if UNITY_ADDRESSABLES
|
|
12
|
+
using UnityEditor.AddressableAssets;
|
|
13
|
+
using UnityEditor.AddressableAssets.Settings;
|
|
14
|
+
using UnityEditor.AddressableAssets.Build;
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// Builds Addressables content after atlas generation
|
|
19
|
+
/// This ensures atlases are available for on-demand loading
|
|
20
|
+
/// </summary>
|
|
21
|
+
public class BuildAddressablesPostprocess : IPostprocessBuildWithReport
|
|
22
|
+
{
|
|
23
|
+
public int callbackOrder => 1; // Run after atlas generation (callbackOrder 0)
|
|
24
|
+
|
|
25
|
+
public void OnPostprocessBuild(BuildReport report)
|
|
26
|
+
{
|
|
27
|
+
#if UNITY_ADDRESSABLES
|
|
28
|
+
Debug.Log("[Addressables] Building Addressables content...");
|
|
29
|
+
|
|
30
|
+
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
31
|
+
if (settings == null)
|
|
32
|
+
{
|
|
33
|
+
Debug.LogError("[Addressables] Addressables settings not found. Cannot build addressables content.");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try
|
|
38
|
+
{
|
|
39
|
+
// Build addressables content
|
|
40
|
+
AddressableAssetSettings.BuildPlayerContent(out AddressablesPlayerBuildResult result);
|
|
41
|
+
|
|
42
|
+
if (!string.IsNullOrEmpty(result.Error))
|
|
43
|
+
{
|
|
44
|
+
Debug.LogError($"[Addressables] Build failed: {result.Error}");
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
{
|
|
48
|
+
Debug.Log($"[Addressables] Build completed successfully. Duration: {result.Duration}");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (System.Exception ex)
|
|
52
|
+
{
|
|
53
|
+
Debug.LogError($"[Addressables] Build exception: {ex.Message}");
|
|
54
|
+
}
|
|
55
|
+
#else
|
|
56
|
+
Debug.LogWarning("[Addressables] Addressables package not installed. Skipping addressables build.");
|
|
57
|
+
#endif
|
|
58
|
+
}
|
|
59
|
+
}
|