@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,147 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.U2D;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Demonstrates proper handling of late-binding for SpriteAtlases.
|
|
7
|
+
/// Late-binding allows atlases to be loaded on-demand when sprites are first accessed.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class HandleLateBinding : MonoBehaviour
|
|
10
|
+
{
|
|
11
|
+
/// <summary>Prefix used for atlas resources</summary>
|
|
12
|
+
[SerializeField] private string _atlasResourcePrefix = "Atlases/";
|
|
13
|
+
|
|
14
|
+
/// <summary>Whether to automatically load atlases</summary>
|
|
15
|
+
[SerializeField] private bool _autoLoad = true;
|
|
16
|
+
|
|
17
|
+
private void Awake()
|
|
18
|
+
{
|
|
19
|
+
if (_autoLoad)
|
|
20
|
+
{
|
|
21
|
+
RegisterLateBinding();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private void OnDestroy()
|
|
26
|
+
{
|
|
27
|
+
UnregisterLateBinding();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Registers for late-binding via SpriteAtlasManager.
|
|
32
|
+
/// When a sprite needs an atlas, the registration callback will be invoked.
|
|
33
|
+
/// </summary>
|
|
34
|
+
public void RegisterLateBinding()
|
|
35
|
+
{
|
|
36
|
+
SpriteAtlasManager.atlasRequested += RequestLateBindingAtlas;
|
|
37
|
+
SpriteAtlasManager.atlasRegistered += AtlasRegistered;
|
|
38
|
+
Debug.Log("Late-binding registered");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Unregisters late-binding callbacks.
|
|
43
|
+
/// Call this when the component is destroyed or no longer needs late-binding.
|
|
44
|
+
/// </summary>
|
|
45
|
+
public void UnregisterLateBinding()
|
|
46
|
+
{
|
|
47
|
+
SpriteAtlasManager.atlasRequested -= RequestLateBindingAtlas;
|
|
48
|
+
SpriteAtlasManager.atlasRegistered -= AtlasRegistered;
|
|
49
|
+
Debug.Log("Late-binding unregistered");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Callback invoked when a sprite needs its atlas but it's not loaded yet.
|
|
54
|
+
/// This is where you implement the late-binding logic.
|
|
55
|
+
/// </summary>
|
|
56
|
+
void RequestLateBindingAtlas(string tag, System.Action<SpriteAtlas> action)
|
|
57
|
+
{
|
|
58
|
+
// Determine which atlas should contain this sprite
|
|
59
|
+
string atlasName = GetAtlasNameForSprite(tag);
|
|
60
|
+
|
|
61
|
+
if (string.IsNullOrEmpty(atlasName))
|
|
62
|
+
{
|
|
63
|
+
Debug.LogWarning($"Could not determine atlas for sprite: {tag}");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Load the atlas asynchronously
|
|
68
|
+
LoadAtlasAsync(atlasName);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// Gets the atlas name for a given sprite.
|
|
73
|
+
/// This is project-specific logic - adjust based on your naming conventions.
|
|
74
|
+
/// </summary>
|
|
75
|
+
private string GetAtlasNameForSprite(string tag)
|
|
76
|
+
{
|
|
77
|
+
// Pattern 1: Use sprite name prefix
|
|
78
|
+
if (tag.StartsWith("btn_"))
|
|
79
|
+
return "UI_Buttons";
|
|
80
|
+
else if (tag.StartsWith("icon_"))
|
|
81
|
+
return "UI_Icons";
|
|
82
|
+
else if (tag.StartsWith("char_"))
|
|
83
|
+
return "Characters";
|
|
84
|
+
return "Default";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
/// Loads an atlas asynchronously.
|
|
89
|
+
/// In a real implementation, this would use Addressables or AssetBundle loading.
|
|
90
|
+
/// </summary>
|
|
91
|
+
private void LoadAtlasAsync(string atlasName)
|
|
92
|
+
{
|
|
93
|
+
// Example using Resources.Load (not recommended for production)
|
|
94
|
+
// SpriteAtlas atlas = Resources.Load<SpriteAtlas>(atlasName);
|
|
95
|
+
|
|
96
|
+
// For production with Addressables:
|
|
97
|
+
/*
|
|
98
|
+
var handle = Addressables.LoadAssetAsync<SpriteAtlas>(atlasName);
|
|
99
|
+
handle.Completed += op =>
|
|
100
|
+
{
|
|
101
|
+
if (op.Status == AsyncOperationStatus.Succeeded)
|
|
102
|
+
{
|
|
103
|
+
Debug.Log($"Late-bound atlas loaded: {atlasName}");
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
{
|
|
107
|
+
Debug.LogError($"Failed to load late-bound atlas: {atlasName}");
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
Debug.Log($"Loading late-bound atlas: {atlasName}");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
void AtlasRegistered(SpriteAtlas spriteAtlas)
|
|
116
|
+
{
|
|
117
|
+
Debug.LogFormat("Registered {0}.", spriteAtlas.name);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// <summary>
|
|
121
|
+
/// Forces loading of a specific atlas (for manual control).
|
|
122
|
+
/// </summary>
|
|
123
|
+
public void ForceLoadAtlas(string atlasName)
|
|
124
|
+
{
|
|
125
|
+
LoadAtlasAsync(atlasName);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// <summary>
|
|
130
|
+
/// Example of using late-binding in a scene with multiple objects.
|
|
131
|
+
/// Each object can request its atlas to be loaded.
|
|
132
|
+
/// </summary>
|
|
133
|
+
public class LateBindingConsumer : MonoBehaviour
|
|
134
|
+
{
|
|
135
|
+
[SerializeField] private Sprite _spriteToDisplay;
|
|
136
|
+
|
|
137
|
+
private void Start()
|
|
138
|
+
{
|
|
139
|
+
// Accessing the sprite will trigger late-binding if needed
|
|
140
|
+
SpriteRenderer renderer = GetComponent<SpriteRenderer>();
|
|
141
|
+
if (renderer != null && _spriteToDisplay != null)
|
|
142
|
+
{
|
|
143
|
+
renderer.sprite = _spriteToDisplay;
|
|
144
|
+
Debug.Log($"Set sprite: {_spriteToDisplay.name}");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.U2D;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Demonstrates proper null handling when working with SpriteAtlases.
|
|
9
|
+
/// Always check for null before accessing assets and importers.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public static class HandleNullCasesExample
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Safely loads a sprite atlas asset with null checking.
|
|
15
|
+
/// </summary>
|
|
16
|
+
public static SpriteAtlasAsset LoadSpriteAtlasSafely(string path)
|
|
17
|
+
{
|
|
18
|
+
// Check if path is valid
|
|
19
|
+
if (string.IsNullOrEmpty(path))
|
|
20
|
+
{
|
|
21
|
+
Debug.LogError("Atlas path is null or empty");
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Load the asset with null check
|
|
26
|
+
SpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>(path);
|
|
27
|
+
|
|
28
|
+
if (atlasAsset == null)
|
|
29
|
+
{
|
|
30
|
+
Debug.LogWarning($"Could not load SpriteAtlasAsset at {path}. It may not exist yet or is invalid.");
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return atlasAsset;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Safely gets the SpriteAtlasImporter with null checking.
|
|
39
|
+
/// </summary>
|
|
40
|
+
public static SpriteAtlasImporter GetSpriteAtlasImporterSafely(string path)
|
|
41
|
+
{
|
|
42
|
+
if (string.IsNullOrEmpty(path))
|
|
43
|
+
{
|
|
44
|
+
Debug.LogError("Atlas path is null or empty");
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Get importer with null check
|
|
49
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(path) as SpriteAtlasImporter;
|
|
50
|
+
|
|
51
|
+
if (importer == null)
|
|
52
|
+
{
|
|
53
|
+
Debug.LogWarning($"Could not get SpriteAtlasImporter for {path}. Is this a valid atlas file?");
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return importer;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// Safely adds sprites to an atlas with null checking.
|
|
62
|
+
/// </summary>
|
|
63
|
+
public static bool AddSpritesToAtlasSafely(SpriteAtlasAsset atlas, Object[] sprites)
|
|
64
|
+
{
|
|
65
|
+
// Check all inputs
|
|
66
|
+
if (atlas == null)
|
|
67
|
+
{
|
|
68
|
+
Debug.LogError("Cannot add sprites: atlas is null");
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (sprites == null || sprites.Length == 0)
|
|
73
|
+
{
|
|
74
|
+
Debug.LogWarning("No sprites provided to add to atlas");
|
|
75
|
+
return true; // Not an error, just nothing to do
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Add sprites
|
|
79
|
+
atlas.Add(sprites);
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
/// Safely configures an atlas with comprehensive null checking.
|
|
85
|
+
/// </summary>
|
|
86
|
+
public static bool ConfigureAtlasSafely(string path)
|
|
87
|
+
{
|
|
88
|
+
// Check path
|
|
89
|
+
if (string.IsNullOrEmpty(path))
|
|
90
|
+
{
|
|
91
|
+
Debug.LogError("Cannot configure atlas: path is null or empty");
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Load asset
|
|
96
|
+
SpriteAtlasAsset atlas = LoadSpriteAtlasSafely(path);
|
|
97
|
+
if (atlas == null)
|
|
98
|
+
{
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Get importer
|
|
103
|
+
SpriteAtlasImporter importer = GetSpriteAtlasImporterSafely(path);
|
|
104
|
+
if (importer == null)
|
|
105
|
+
{
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Configure settings
|
|
110
|
+
try
|
|
111
|
+
{
|
|
112
|
+
importer.includeInBuild = true;
|
|
113
|
+
var packingSettings = importer.packingSettings;
|
|
114
|
+
packingSettings.enableTightPacking = true;
|
|
115
|
+
importer.packingSettings = packingSettings;
|
|
116
|
+
importer.SaveAndReimport();
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch (System.Exception ex)
|
|
120
|
+
{
|
|
121
|
+
Debug.LogError($"Failed to configure atlas: {ex.Message}");
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/// <summary>
|
|
127
|
+
/// Safely gets sprites from an atlas with null checking.
|
|
128
|
+
/// </summary>
|
|
129
|
+
public static Object[] GetAtlasSpritesSafely(SpriteAtlas atlas)
|
|
130
|
+
{
|
|
131
|
+
if (atlas == null)
|
|
132
|
+
{
|
|
133
|
+
Debug.LogError("Cannot get sprites: atlas is null");
|
|
134
|
+
return new Object[0];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Use GetPackables() - this is the V2 way
|
|
138
|
+
Object[] packables = atlas.GetPackables();
|
|
139
|
+
return packables ?? new Object[0];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Migration guide from SpriteAtlas V1 to V2.
|
|
8
|
+
/// This file shows the key differences and how to update existing code.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public static class MigrateV1ToV2Documentation
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// V1 Pattern: Direct SpriteAtlas scripting (NO LONGER WORKS)
|
|
14
|
+
///
|
|
15
|
+
/// ❌ OLD V1 CODE:
|
|
16
|
+
/// var atlas = ScriptableObject.CreateInstance<SpriteAtlas>();
|
|
17
|
+
/// atlas.Add(sprites);
|
|
18
|
+
/// AssetDatabase.AddObjectToAsset(atlas, path);
|
|
19
|
+
/// EditorUtility.SetDirty(atlas);
|
|
20
|
+
///
|
|
21
|
+
/// ✅ NEW V2 CODE:
|
|
22
|
+
/// SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
23
|
+
/// asset.Add(sprites);
|
|
24
|
+
/// SpriteAtlasAsset.Save(asset, path);
|
|
25
|
+
/// AssetDatabase.ImportAsset(path);
|
|
26
|
+
/// </summary>
|
|
27
|
+
public static void Migration_1_CreateAtlas()
|
|
28
|
+
{
|
|
29
|
+
// ===== MIGRATION 1: Creating an Atlas =====
|
|
30
|
+
|
|
31
|
+
// ❌ OLD (V1 - Broken):
|
|
32
|
+
/*
|
|
33
|
+
var atlas = ScriptableObject.CreateInstance<SpriteAtlas>();
|
|
34
|
+
atlas.Add(sprites);
|
|
35
|
+
AssetDatabase.AddObjectToAsset(atlas, path);
|
|
36
|
+
EditorUtility.SetDirty(atlas);
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// ✅ NEW (V2):
|
|
40
|
+
SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
41
|
+
asset.Add(new Object[0]); // Add sprites
|
|
42
|
+
SpriteAtlasAsset.Save(asset, "Assets/MyAtlas.spriteatlasv2");
|
|
43
|
+
AssetDatabase.ImportAsset("Assets/MyAtlas.spriteatlasv2");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// V1 Pattern: Direct configuration (NO LONGER WORKS)
|
|
48
|
+
///
|
|
49
|
+
/// ❌ OLD V1 CODE:
|
|
50
|
+
/// var importer = (SpriteAtlasImporter)AssetImporter.GetAtPath(path);
|
|
51
|
+
/// importer.SetBuildSettings(settings);
|
|
52
|
+
///
|
|
53
|
+
/// ✅ NEW V2 CODE:
|
|
54
|
+
/// var importer = (SpriteAtlasImporter)AssetImporter.GetAtPath(path);
|
|
55
|
+
/// importer.packingSettings = settings;
|
|
56
|
+
/// importer.SaveAndReimport();
|
|
57
|
+
/// </summary>
|
|
58
|
+
public static void Migration_2_ConfigureAtlas()
|
|
59
|
+
{
|
|
60
|
+
// ===== MIGRATION 2: Configuring an Atlas =====
|
|
61
|
+
|
|
62
|
+
// ❌ OLD (V1 - Deprecated):
|
|
63
|
+
/*
|
|
64
|
+
var importer = (SpriteAtlasImporter)AssetImporter.GetAtPath(path);
|
|
65
|
+
importer.SetBuildSettings(settings); // Method removed!
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
// ✅ NEW (V2):
|
|
69
|
+
SpriteAtlasImporter importer = null; // Get from AssetImporter
|
|
70
|
+
// importer.packingSettings = settings;
|
|
71
|
+
// importer.SaveAndReimport();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// V1 Pattern: Loading in editor (NO LONGER WORKS)
|
|
76
|
+
///
|
|
77
|
+
/// ❌ OLD V1 CODE:
|
|
78
|
+
/// var atlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(path);
|
|
79
|
+
///
|
|
80
|
+
/// ✅ NEW V2 CODE:
|
|
81
|
+
/// var asset = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>(path);
|
|
82
|
+
/// </summary>
|
|
83
|
+
public static void Migration_3_LoadInEditor()
|
|
84
|
+
{
|
|
85
|
+
// ===== MIGRATION 3: Loading Atlases in Editor =====
|
|
86
|
+
|
|
87
|
+
// ❌ OLD (V1 - Broken):
|
|
88
|
+
/*
|
|
89
|
+
var atlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(path); // Returns null!
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
// ✅ NEW (V2):
|
|
93
|
+
SpriteAtlasAsset asset = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>("Assets/MyAtlas.spriteatlasv2");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// <summary>
|
|
97
|
+
/// V1 Pattern: Runtime loading (CHANGED SIGNIFICANTLY)
|
|
98
|
+
///
|
|
99
|
+
/// ❌ OLD V1 CODE:
|
|
100
|
+
/// var atlas = Resources.Load<SpriteAtlas>("Atlases/MyAtlas");
|
|
101
|
+
///
|
|
102
|
+
/// ✅ NEW V2 CODE:
|
|
103
|
+
/// SpriteAtlasManager.atlasRegistrationNeeded += OnRegistrationNeeded;
|
|
104
|
+
/// // Or use Addressables for dynamic loading
|
|
105
|
+
/// </summary>
|
|
106
|
+
public static void Migration_4_RuntimeLoading()
|
|
107
|
+
{
|
|
108
|
+
// ===== MIGRATION 4: Runtime Loading =====
|
|
109
|
+
|
|
110
|
+
// ❌ OLD (V1 - Not recommended):
|
|
111
|
+
/*
|
|
112
|
+
var atlas = Resources.Load<SpriteAtlas>("Atlases/MyAtlas");
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
// ✅ NEW (V2 - Recommended):
|
|
116
|
+
// Use SpriteAtlasManager with late-binding
|
|
117
|
+
/*
|
|
118
|
+
public class MyLoader : MonoBehaviour
|
|
119
|
+
{
|
|
120
|
+
private void Awake()
|
|
121
|
+
{
|
|
122
|
+
SpriteAtlasManager.atlasRegistrationNeeded += OnRegistrationNeeded;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private void OnRegistrationNeeded(Sprite sprite)
|
|
126
|
+
{
|
|
127
|
+
// Load atlas via Addressables or AssetBundles
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
*/
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/// <summary>
|
|
134
|
+
/// V1 Pattern: Manual packing (CHANGED)
|
|
135
|
+
///
|
|
136
|
+
/// ❌ OLD V1 CODE:
|
|
137
|
+
/// SpriteAtlasUtility.PackAtlases(atlases, BuildTarget.StandaloneWindows64);
|
|
138
|
+
///
|
|
139
|
+
/// ✅ NEW V2 CODE:
|
|
140
|
+
/// Use IPreprocessBuildWithReport for automatic packing during build
|
|
141
|
+
/// </summary>
|
|
142
|
+
public static void Migration_5_Packing()
|
|
143
|
+
{
|
|
144
|
+
// ===== MIGRATION 5: Packing Atlases =====
|
|
145
|
+
|
|
146
|
+
// ❌ OLD (V1 - Manual):
|
|
147
|
+
/*
|
|
148
|
+
SpriteAtlasUtility.PackAtlases(atlases, BuildTarget.StandaloneWindows64);
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
// ✅ NEW (V2 - Automatic via Prebuild):
|
|
152
|
+
/*
|
|
153
|
+
public class MyPreprocessor : IPreprocessBuildWithReport
|
|
154
|
+
{
|
|
155
|
+
public void OnPreprocessBuild(BuildTarget target, string path)
|
|
156
|
+
{
|
|
157
|
+
// Atlases are automatically packed during build
|
|
158
|
+
// Use this for generation/configuration, not manual packing
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
*/
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// <summary>
|
|
165
|
+
/// Complete migration checklist:
|
|
166
|
+
///
|
|
167
|
+
/// [ ] Replace SpriteAtlas creation with SpriteAtlasAsset
|
|
168
|
+
/// [ ] Use SpriteAtlasImporter for all configuration
|
|
169
|
+
/// [ ] Call SaveAndReimport() after every modification
|
|
170
|
+
/// [ ] Use SpriteAtlasManager for runtime loading
|
|
171
|
+
/// [ ] Implement IPreprocessBuildWithReport for automatic generation
|
|
172
|
+
/// [ ] Use .spriteatlasv2 file extension (not .spriteatlas)
|
|
173
|
+
/// </summary>
|
|
174
|
+
public static void Migration_Checklist()
|
|
175
|
+
{
|
|
176
|
+
/*
|
|
177
|
+
MIGRATION CHECKLIST:
|
|
178
|
+
====================
|
|
179
|
+
|
|
180
|
+
1. Asset Creation
|
|
181
|
+
- OLD: ScriptableObject.CreateInstance<SpriteAtlas>()
|
|
182
|
+
- NEW: new SpriteAtlasAsset()
|
|
183
|
+
|
|
184
|
+
2. Saving Assets
|
|
185
|
+
- OLD: AssetDatabase.AddObjectToAsset(), EditorUtility.SetDirty()
|
|
186
|
+
- NEW: SpriteAtlasAsset.Save(), AssetDatabase.ImportAsset()
|
|
187
|
+
|
|
188
|
+
3. Configuration
|
|
189
|
+
- OLD: importer.SetBuildSettings()
|
|
190
|
+
- NEW: importer.packingSettings, importer.platformSettings
|
|
191
|
+
|
|
192
|
+
4. Saving Changes
|
|
193
|
+
- OLD: EditorUtility.SetDirty()
|
|
194
|
+
- NEW: importer.SaveAndReimport()
|
|
195
|
+
|
|
196
|
+
5. Loading in Editor
|
|
197
|
+
- OLD: AssetDatabase.LoadAssetAtPath<SpriteAtlas>()
|
|
198
|
+
- NEW: AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>()
|
|
199
|
+
|
|
200
|
+
6. Runtime Loading
|
|
201
|
+
- OLD: Resources.Load<SpriteAtlas>()
|
|
202
|
+
- NEW: SpriteAtlasManager + Addressables/AssetBundles
|
|
203
|
+
|
|
204
|
+
7. File Extension
|
|
205
|
+
- OLD: .spriteatlas
|
|
206
|
+
- NEW: .spriteatlasv2
|
|
207
|
+
*/
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/// <summary>
|
|
212
|
+
/// Example: Complete V1 to V2 migration for a build script.
|
|
213
|
+
/// </summary>
|
|
214
|
+
public static class BuildScriptMigrationExample
|
|
215
|
+
{
|
|
216
|
+
/// <summary>
|
|
217
|
+
/// ❌ OLD V1 Build Script (BROKEN):
|
|
218
|
+
/// This script will NOT work with SpriteAtlas V2.
|
|
219
|
+
/// </summary>
|
|
220
|
+
[System.Obsolete("This is the old V1 pattern - do not use")]
|
|
221
|
+
public static void Old_V1_BuildScript()
|
|
222
|
+
{
|
|
223
|
+
// ❌ BROKEN: This is the old V1 way
|
|
224
|
+
/*
|
|
225
|
+
[MenuItem("Tools/Build Game")]
|
|
226
|
+
public static void BuildGame()
|
|
227
|
+
{
|
|
228
|
+
// Create atlas (V1 - Broken)
|
|
229
|
+
var atlas = ScriptableObject.CreateInstance<SpriteAtlas>();
|
|
230
|
+
atlas.Add(AssetDatabase.LoadAllAssetsAtPath("Assets/Sprites"));
|
|
231
|
+
|
|
232
|
+
// Save atlas (V1 - Broken)
|
|
233
|
+
AssetDatabase.AddObjectToAsset(atlas, "Assets/MyAtlas.spriteatlas");
|
|
234
|
+
EditorUtility.SetDirty(atlas);
|
|
235
|
+
|
|
236
|
+
// Configure (V1 - Broken)
|
|
237
|
+
var importer = (SpriteAtlasImporter)AssetImporter.GetAtPath("Assets/MyAtlas.spriteatlas");
|
|
238
|
+
importer.SetBuildSettings(new SpriteAtlasPackingSettings()); // Method removed!
|
|
239
|
+
|
|
240
|
+
// Build
|
|
241
|
+
BuildPipeline.BuildPlayer(...);
|
|
242
|
+
}
|
|
243
|
+
*/
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/// <summary>
|
|
247
|
+
/// ✅ NEW V2 Build Script (WORKING):
|
|
248
|
+
/// This script works with SpriteAtlas V2.
|
|
249
|
+
/// </summary>
|
|
250
|
+
public static void New_V2_BuildScript()
|
|
251
|
+
{
|
|
252
|
+
// ✅ WORKING: This is the new V2 way
|
|
253
|
+
|
|
254
|
+
/*
|
|
255
|
+
[MenuItem("Tools/Build Game")]
|
|
256
|
+
public static void BuildGame()
|
|
257
|
+
{
|
|
258
|
+
// Step 1: Generate/update atlases (V2)
|
|
259
|
+
string[] guids = AssetDatabase.FindAssets("t:SpriteAtlasAsset", new[] { "Assets" });
|
|
260
|
+
foreach (string guid in guids)
|
|
261
|
+
{
|
|
262
|
+
string path = AssetDatabase.GUIDToAssetPath(guid);
|
|
263
|
+
var asset = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>(path);
|
|
264
|
+
|
|
265
|
+
// Add sprites if needed
|
|
266
|
+
// asset.Add(sprites);
|
|
267
|
+
|
|
268
|
+
// Save and import
|
|
269
|
+
SpriteAtlasAsset.Save(asset, path);
|
|
270
|
+
AssetDatabase.ImportAsset(path);
|
|
271
|
+
|
|
272
|
+
// Configure via importer (V2)
|
|
273
|
+
var importer = AssetImporter.GetAtPath(path) as SpriteAtlasImporter;
|
|
274
|
+
importer.includeInBuild = true;
|
|
275
|
+
importer.packingSettings.tightPacking = true;
|
|
276
|
+
importer.SaveAndReimport();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Step 2: Build the game
|
|
280
|
+
BuildPipeline.BuildPlayer(...);
|
|
281
|
+
}
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
Debug.Log("Use V2 pattern instead of V1");
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/// <summary>
|
|
288
|
+
/// ✅ NEW V2 Prebuild Processor (RECOMMENDED):
|
|
289
|
+
/// This is the recommended approach - automatic atlas generation during build.
|
|
290
|
+
/// </summary>
|
|
291
|
+
public static void New_V2_PreprocessBuild()
|
|
292
|
+
{
|
|
293
|
+
// ✅ RECOMMENDED: Use prebuild processor for automatic generation
|
|
294
|
+
|
|
295
|
+
/*
|
|
296
|
+
public class AtlasPreprocessor : IPreprocessBuildWithReport
|
|
297
|
+
{
|
|
298
|
+
public int callbackOrder => 0;
|
|
299
|
+
|
|
300
|
+
public void OnPreprocessBuild(BuildTarget target, string path)
|
|
301
|
+
{
|
|
302
|
+
// Automatically generate or update atlases before build
|
|
303
|
+
GenerateAtlases();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
private void GenerateAtlases()
|
|
307
|
+
{
|
|
308
|
+
// Find sprites by folder, naming convention, or label
|
|
309
|
+
string[] guids = AssetDatabase.FindAssets("t:Sprite", new[] { "Assets/Sprites" });
|
|
310
|
+
|
|
311
|
+
// Create atlas asset
|
|
312
|
+
var asset = new SpriteAtlasAsset();
|
|
313
|
+
var sprites = new Object[guids.Length];
|
|
314
|
+
for (int i = 0; i < guids.Length; i++)
|
|
315
|
+
{
|
|
316
|
+
sprites[i] = AssetDatabase.LoadAssetAtPath<Sprite>(
|
|
317
|
+
AssetDatabase.GUIDToAssetPath(guids[i]));
|
|
318
|
+
}
|
|
319
|
+
asset.Add(sprites);
|
|
320
|
+
|
|
321
|
+
// Save and import
|
|
322
|
+
string path = "Assets/Atlases/GameSprites.spriteatlasv2";
|
|
323
|
+
SpriteAtlasAsset.Save(asset, path);
|
|
324
|
+
AssetDatabase.ImportAsset(path);
|
|
325
|
+
|
|
326
|
+
// Configure via importer
|
|
327
|
+
var importer = AssetImporter.GetAtPath(path) as SpriteAtlasImporter;
|
|
328
|
+
importer.includeInBuild = true;
|
|
329
|
+
importer.packingSettings.tightPacking = true;
|
|
330
|
+
importer.SaveAndReimport();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
*/
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor.U2D;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using Unity.Collections;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Distributes sprites across multiple atlas pages with automatic page management.
|
|
8
|
+
/// Handles both row wrapping within a page and page overflow.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class MultiPagePacker : ScriptablePacker
|
|
11
|
+
{
|
|
12
|
+
/// <summary>Maximum number of sprites per page</summary>
|
|
13
|
+
public int maxSpritesPerPage = 64;
|
|
14
|
+
|
|
15
|
+
/// <summary>Width of each atlas page in pixels</summary>
|
|
16
|
+
public int pageWidth = 2048;
|
|
17
|
+
|
|
18
|
+
/// <summary>Padding between sprites in pixels</summary>
|
|
19
|
+
public int padding = 4;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Packs sprites across multiple pages.
|
|
23
|
+
/// Automatically creates new pages when the current page is full or a row wraps.
|
|
24
|
+
/// </summary>
|
|
25
|
+
public override bool Pack(SpriteAtlasPackingSettings config,
|
|
26
|
+
SpriteAtlasTextureSettings setting,
|
|
27
|
+
PackerData input)
|
|
28
|
+
{
|
|
29
|
+
NativeArray<SpriteData> sprites = input.spriteData;
|
|
30
|
+
NativeArray<TextureData> textures = input.textureData;
|
|
31
|
+
|
|
32
|
+
int currentPage = 0;
|
|
33
|
+
int spritesInPage = 0;
|
|
34
|
+
int currentX = padding;
|
|
35
|
+
int currentY = padding;
|
|
36
|
+
int maxHeightInRow = 0;
|
|
37
|
+
|
|
38
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
39
|
+
{
|
|
40
|
+
SpriteData sprite = sprites[i];
|
|
41
|
+
TextureData texture = textures[sprite.texIndex];
|
|
42
|
+
|
|
43
|
+
int spriteWidth = sprite.rect.width;
|
|
44
|
+
int spriteHeight = sprite.rect.height;
|
|
45
|
+
|
|
46
|
+
// Check if we need a new page
|
|
47
|
+
if (spritesInPage >= maxSpritesPerPage)
|
|
48
|
+
{
|
|
49
|
+
currentPage++;
|
|
50
|
+
spritesInPage = 0;
|
|
51
|
+
currentX = padding;
|
|
52
|
+
currentY = padding;
|
|
53
|
+
maxHeightInRow = 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Check if we need a new row
|
|
57
|
+
if (currentX + spriteWidth + padding > pageWidth)
|
|
58
|
+
{
|
|
59
|
+
currentX = padding;
|
|
60
|
+
currentY += maxHeightInRow + padding;
|
|
61
|
+
maxHeightInRow = 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Set output
|
|
65
|
+
sprite.output.x = currentX;
|
|
66
|
+
sprite.output.y = currentY;
|
|
67
|
+
sprite.output.page = currentPage;
|
|
68
|
+
sprite.output.rot = PackTransform.None;
|
|
69
|
+
|
|
70
|
+
// Update position for next sprite
|
|
71
|
+
currentX += spriteWidth + padding;
|
|
72
|
+
maxHeightInRow = Mathf.Max(maxHeightInRow, spriteHeight);
|
|
73
|
+
spritesInPage++;
|
|
74
|
+
|
|
75
|
+
sprites[i] = sprite;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|