@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,222 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.U2D;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using UnityEditor.U2D;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Demonstrates efficient querying of sprites from SpriteAtlases.
|
|
9
|
+
/// Avoids expensive operations and unnecessary allocations.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public static class QuerySpritesEfficientlyExample
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Gets all sprites from an atlas efficiently.
|
|
15
|
+
/// Uses the V2 GetPackables() method on runtime SpriteAtlas.
|
|
16
|
+
/// </summary>
|
|
17
|
+
public static Sprite[] GetSpritesFromAtlas(SpriteAtlas atlas)
|
|
18
|
+
{
|
|
19
|
+
if (atlas == null)
|
|
20
|
+
{
|
|
21
|
+
Debug.LogError("Cannot query: atlas is null");
|
|
22
|
+
return new Sprite[0];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Use GetPackables() - this is the V2 way
|
|
26
|
+
Object[] packables = atlas.GetPackables();
|
|
27
|
+
|
|
28
|
+
// Filter to get only sprites
|
|
29
|
+
var sprites = new List<Sprite>();
|
|
30
|
+
for (int i = 0; i < packables.Length; i++)
|
|
31
|
+
{
|
|
32
|
+
if (packables[i] is Sprite sprite)
|
|
33
|
+
{
|
|
34
|
+
sprites.Add(sprite);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return sprites.ToArray();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
/// Gets a sprite by name from an atlas efficiently.
|
|
43
|
+
/// Avoids iterating through all sprites on each call by caching the results.
|
|
44
|
+
/// </summary>
|
|
45
|
+
public static Sprite GetSpriteFromAtlas(SpriteAtlas atlas, string spriteName)
|
|
46
|
+
{
|
|
47
|
+
if (atlas == null)
|
|
48
|
+
{
|
|
49
|
+
Debug.LogError("Cannot query: atlas is null");
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (string.IsNullOrEmpty(spriteName))
|
|
54
|
+
{
|
|
55
|
+
Debug.LogWarning("Cannot query: sprite name is null or empty");
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Get all sprites once
|
|
60
|
+
Sprite[] sprites = GetSpritesFromAtlas(atlas);
|
|
61
|
+
|
|
62
|
+
// Find matching sprite
|
|
63
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
64
|
+
{
|
|
65
|
+
if (sprites[i].name == spriteName)
|
|
66
|
+
{
|
|
67
|
+
return sprites[i];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Debug.LogWarning($"Sprite '{spriteName}' not found in atlas: {atlas.name}");
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Queries multiple sprites by name from an atlas.
|
|
77
|
+
/// More efficient than calling GetSpriteFromAtlas multiple times
|
|
78
|
+
/// when you need to query many sprites at once.
|
|
79
|
+
/// </summary>
|
|
80
|
+
public static Sprite[] GetSpritesFromAtlas(SpriteAtlas atlas, string[] spriteNames)
|
|
81
|
+
{
|
|
82
|
+
if (atlas == null || spriteNames == null || spriteNames.Length == 0)
|
|
83
|
+
return new Sprite[0];
|
|
84
|
+
|
|
85
|
+
// Get all sprites once
|
|
86
|
+
Sprite[] allSprites = GetSpritesFromAtlas(atlas);
|
|
87
|
+
|
|
88
|
+
// Create lookup dictionary for efficient searching
|
|
89
|
+
var spriteLookup = new Dictionary<string, Sprite>();
|
|
90
|
+
for (int i = 0; i < allSprites.Length; i++)
|
|
91
|
+
{
|
|
92
|
+
spriteLookup[allSprites[i].name] = allSprites[i];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Query requested sprites
|
|
96
|
+
var result = new List<Sprite>(spriteNames.Length);
|
|
97
|
+
for (int i = 0; i < spriteNames.Length; i++)
|
|
98
|
+
{
|
|
99
|
+
if (spriteLookup.TryGetValue(spriteNames[i], out Sprite foundSprite))
|
|
100
|
+
{
|
|
101
|
+
result.Add(foundSprite);
|
|
102
|
+
}
|
|
103
|
+
else
|
|
104
|
+
{
|
|
105
|
+
Debug.LogWarning($"Sprite '{spriteNames[i]}' not found in atlas: {atlas.name}");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return result.ToArray();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// <summary>
|
|
113
|
+
/// Checks if an atlas contains a specific sprite by name.
|
|
114
|
+
/// </summary>
|
|
115
|
+
public static bool ContainsSprite(SpriteAtlas atlas, string spriteName)
|
|
116
|
+
{
|
|
117
|
+
if (atlas == null || string.IsNullOrEmpty(spriteName))
|
|
118
|
+
return false;
|
|
119
|
+
|
|
120
|
+
Sprite[] sprites = GetSpritesFromAtlas(atlas);
|
|
121
|
+
|
|
122
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
123
|
+
{
|
|
124
|
+
if (sprites[i].name == spriteName)
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// Gets the count of sprites in an atlas without loading all sprites.
|
|
133
|
+
/// </summary>
|
|
134
|
+
public static int GetSpriteCount(SpriteAtlas atlas)
|
|
135
|
+
{
|
|
136
|
+
if (atlas == null)
|
|
137
|
+
return 0;
|
|
138
|
+
|
|
139
|
+
Object[] packables = atlas.GetPackables();
|
|
140
|
+
int count = 0;
|
|
141
|
+
|
|
142
|
+
for (int i = 0; i < packables.Length; i++)
|
|
143
|
+
{
|
|
144
|
+
if (packables[i] is Sprite)
|
|
145
|
+
count++;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return count;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/// <summary>
|
|
153
|
+
/// Component that demonstrates efficient sprite querying.
|
|
154
|
+
/// Caches queries for repeated access.
|
|
155
|
+
/// </summary>
|
|
156
|
+
public class EfficientSpriteQuery : MonoBehaviour
|
|
157
|
+
{
|
|
158
|
+
[SerializeField] private SpriteAtlas _atlas;
|
|
159
|
+
|
|
160
|
+
private Dictionary<string, Sprite> _spriteCache;
|
|
161
|
+
private bool _cacheInitialized = false;
|
|
162
|
+
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// Initializes the cache with all sprites from the atlas.
|
|
165
|
+
/// Call this once at startup for efficient repeated queries.
|
|
166
|
+
/// </summary>
|
|
167
|
+
public void InitializeCache()
|
|
168
|
+
{
|
|
169
|
+
if (_atlas == null)
|
|
170
|
+
return;
|
|
171
|
+
|
|
172
|
+
Sprite[] sprites = QuerySpritesEfficientlyExample.GetSpritesFromAtlas(_atlas);
|
|
173
|
+
|
|
174
|
+
_spriteCache = new Dictionary<string, Sprite>(sprites.Length);
|
|
175
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
176
|
+
{
|
|
177
|
+
_spriteCache[sprites[i].name] = sprites[i];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
_cacheInitialized = true;
|
|
181
|
+
Debug.Log($"Cached {sprites.Length} sprites from atlas: {_atlas.name}");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// <summary>
|
|
185
|
+
/// Gets a sprite by name using the cached lookup.
|
|
186
|
+
/// Much faster than querying the atlas directly for each call.
|
|
187
|
+
/// </summary>
|
|
188
|
+
public Sprite GetCachedSprite(string name)
|
|
189
|
+
{
|
|
190
|
+
if (!_cacheInitialized)
|
|
191
|
+
{
|
|
192
|
+
InitializeCache();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (_spriteCache.TryGetValue(name, out Sprite sprite))
|
|
196
|
+
{
|
|
197
|
+
return sprite;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
Debug.LogWarning($"Sprite '{name}' not found in cached atlas");
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/// <summary>
|
|
205
|
+
/// Gets a sprite by name, with optional cache initialization.
|
|
206
|
+
/// </summary>
|
|
207
|
+
public Sprite GetSprite(string name, bool initializeIfNeeded = true)
|
|
208
|
+
{
|
|
209
|
+
if (!_cacheInitialized && initializeIfNeeded)
|
|
210
|
+
{
|
|
211
|
+
InitializeCache();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (_spriteCache != null && _spriteCache.TryGetValue(name, out Sprite sprite))
|
|
215
|
+
{
|
|
216
|
+
return sprite;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Fallback to direct query if cache not available
|
|
220
|
+
return QuerySpritesEfficientlyExample.GetSpriteFromAtlas(_atlas, name);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.U2D;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Demonstrates registering SpriteAtlasManager callbacks early in the lifecycle.
|
|
7
|
+
/// Always register callbacks in Awake() or OnEnable(), not in Start().
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class RegisterCallbacksExample : MonoBehaviour
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// Registers atlas loading callbacks when the component awakens.
|
|
13
|
+
/// This is the correct place - before any sprites might need atlases.
|
|
14
|
+
/// </summary>
|
|
15
|
+
private void Awake()
|
|
16
|
+
{
|
|
17
|
+
RegisterAtlasCallbacks();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Registers SpriteAtlasManager callbacks for dynamic atlas loading.
|
|
22
|
+
/// Called during Awake() to ensure callbacks are ready before any sprite access.
|
|
23
|
+
/// </summary>
|
|
24
|
+
private void RegisterAtlasCallbacks()
|
|
25
|
+
{
|
|
26
|
+
// Register for atlas load events
|
|
27
|
+
SpriteAtlasManager.atlasRequested += RequestLateBindingAtlas;
|
|
28
|
+
SpriteAtlasManager.atlasRegistered += AtlasRegistered;
|
|
29
|
+
|
|
30
|
+
Debug.Log("SpriteAtlas callbacks registered");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Unregisters callbacks when the component is destroyed.
|
|
35
|
+
/// Always unregister to prevent memory leaks and errors.
|
|
36
|
+
/// </summary>
|
|
37
|
+
private void OnDestroy()
|
|
38
|
+
{
|
|
39
|
+
SpriteAtlasManager.atlasRequested -= RequestLateBindingAtlas;
|
|
40
|
+
SpriteAtlasManager.atlasRegistered -= AtlasRegistered;
|
|
41
|
+
|
|
42
|
+
Debug.Log("SpriteAtlas callbacks unregistered");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// Callback invoked when a sprite needs its atlas but it's not loaded yet.
|
|
47
|
+
/// This is where you implement the late-binding logic.
|
|
48
|
+
/// </summary>
|
|
49
|
+
void RequestLateBindingAtlas(string tag, System.Action<SpriteAtlas> action)
|
|
50
|
+
{
|
|
51
|
+
// Determine which atlas should contain this sprite
|
|
52
|
+
string atlasName = GetAtlasNameForSprite(tag);
|
|
53
|
+
|
|
54
|
+
if (string.IsNullOrEmpty(atlasName))
|
|
55
|
+
{
|
|
56
|
+
Debug.LogWarning($"Could not determine atlas for sprite: {tag}");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Load the atlas asynchronously
|
|
61
|
+
LoadAtlasAsync(atlasName);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// <summary>
|
|
65
|
+
/// Gets the atlas name for a given sprite.
|
|
66
|
+
/// This is project-specific logic - adjust based on your naming conventions.
|
|
67
|
+
/// </summary>
|
|
68
|
+
private string GetAtlasNameForSprite(string tag)
|
|
69
|
+
{
|
|
70
|
+
// Pattern 1: Use sprite name prefix
|
|
71
|
+
if (tag.StartsWith("btn_"))
|
|
72
|
+
return "UI_Buttons";
|
|
73
|
+
else if (tag.StartsWith("icon_"))
|
|
74
|
+
return "UI_Icons";
|
|
75
|
+
else if (tag.StartsWith("char_"))
|
|
76
|
+
return "Characters";
|
|
77
|
+
return "Default";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// <summary>
|
|
81
|
+
/// Loads an atlas asynchronously.
|
|
82
|
+
/// In a real implementation, this would use Addressables or AssetBundle loading.
|
|
83
|
+
/// </summary>
|
|
84
|
+
private void LoadAtlasAsync(string atlasName)
|
|
85
|
+
{
|
|
86
|
+
// Example using Resources.Load (not recommended for production)
|
|
87
|
+
// SpriteAtlas atlas = Resources.Load<SpriteAtlas>(atlasName);
|
|
88
|
+
|
|
89
|
+
// For production with Addressables:
|
|
90
|
+
/*
|
|
91
|
+
var handle = Addressables.LoadAssetAsync<SpriteAtlas>(atlasName);
|
|
92
|
+
handle.Completed += op =>
|
|
93
|
+
{
|
|
94
|
+
if (op.Status == AsyncOperationStatus.Succeeded)
|
|
95
|
+
{
|
|
96
|
+
Debug.Log($"Late-bound atlas loaded: {atlasName}");
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
{
|
|
100
|
+
Debug.LogError($"Failed to load late-bound atlas: {atlasName}");
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
Debug.Log($"Loading late-bound atlas: {atlasName}");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void AtlasRegistered(SpriteAtlas spriteAtlas)
|
|
109
|
+
{
|
|
110
|
+
Debug.LogFormat("Registered {0}.", spriteAtlas.name);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/// <summary>
|
|
114
|
+
/// Forces loading of a specific atlas (for manual control).
|
|
115
|
+
/// </summary>
|
|
116
|
+
public void ForceLoadAtlas(string atlasName)
|
|
117
|
+
{
|
|
118
|
+
LoadAtlasAsync(atlasName);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
/// Alternative pattern using OnEnable/OnDisable instead of Awake/OnDestroy.
|
|
124
|
+
/// Use this if the component can be enabled/disabled dynamically.
|
|
125
|
+
/// </summary>
|
|
126
|
+
public class RegisterCallbacksWithEnable : MonoBehaviour
|
|
127
|
+
{
|
|
128
|
+
private void OnEnable()
|
|
129
|
+
{
|
|
130
|
+
RegisterAtlasCallbacks();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private void OnDisable()
|
|
134
|
+
{
|
|
135
|
+
UnregisterAtlasCallbacks();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private void RegisterAtlasCallbacks()
|
|
139
|
+
{
|
|
140
|
+
SpriteAtlasManager.atlasRequested += RequestLateBindingAtlas;
|
|
141
|
+
SpriteAtlasManager.atlasRegistered += OnAtlasLoaded;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private void UnregisterAtlasCallbacks()
|
|
145
|
+
{
|
|
146
|
+
SpriteAtlasManager.atlasRequested -= RequestLateBindingAtlas;
|
|
147
|
+
SpriteAtlasManager.atlasRegistered -= OnAtlasLoaded;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private void OnAtlasLoaded(SpriteAtlas atlas) { }
|
|
151
|
+
private void RequestLateBindingAtlas(string tag, System.Action<SpriteAtlas> action) { }
|
|
152
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.U2D;
|
|
3
|
+
|
|
4
|
+
public class AtlasLoader : MonoBehaviour
|
|
5
|
+
{
|
|
6
|
+
void OnEnable() => SpriteAtlasManager.atlasRequested += OnAtlasRequested;
|
|
7
|
+
void OnDisable() => SpriteAtlasManager.atlasRequested -= OnAtlasRequested;
|
|
8
|
+
|
|
9
|
+
void OnAtlasRequested(string tag, System.Action<SpriteAtlas> callback)
|
|
10
|
+
{
|
|
11
|
+
// Load from Resources or AssetBundle (NOT AssetDatabase!)
|
|
12
|
+
SpriteAtlas atlas = Resources.Load<SpriteAtlas>($"Atlases/{tag}");
|
|
13
|
+
callback(atlas);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.U2D;
|
|
3
|
+
|
|
4
|
+
// Query sprites *after* atlas is loaded via SpriteAtlasManager
|
|
5
|
+
public static class SpriteQueryHelper
|
|
6
|
+
{
|
|
7
|
+
public static Sprite GetSpriteByName(SpriteAtlas atlas, string name)
|
|
8
|
+
{
|
|
9
|
+
// atlas.GetSprite(name) is safe in runtime context
|
|
10
|
+
return atlas.GetSprite(name);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public static Sprite[] GetSpritesByPrefix(SpriteAtlas atlas, string prefix)
|
|
14
|
+
{
|
|
15
|
+
Sprite[] sprites = new Sprite[atlas.spriteCount];
|
|
16
|
+
int count = atlas.GetSprites(sprites);
|
|
17
|
+
return System.Array.FindAll(sprites, s => s.name.StartsWith(prefix));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using UnityEngine.U2D;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Demonstrates proper saving of SpriteAtlasAsset.
|
|
9
|
+
/// Always use SpriteAtlasAsset.Save() followed by AssetDatabase.ImportAsset().
|
|
10
|
+
/// </summary>
|
|
11
|
+
public static class SaveSpriteAtlasAssetExample
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Creates and saves a new sprite atlas asset properly.
|
|
15
|
+
/// Follows the two-step V2 pattern: Create → Save → Import → Configure.
|
|
16
|
+
/// </summary>
|
|
17
|
+
public static void CreateAndSaveAtlas(string path, Object[] sprites)
|
|
18
|
+
{
|
|
19
|
+
// Step 1: Create the atlas asset in memory
|
|
20
|
+
SpriteAtlasAsset atlasAsset = new SpriteAtlasAsset();
|
|
21
|
+
|
|
22
|
+
// Step 2: Add sprites to the atlas
|
|
23
|
+
if (sprites != null && sprites.Length > 0)
|
|
24
|
+
{
|
|
25
|
+
atlasAsset.Add(sprites);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Step 3: Save the asset to disk
|
|
29
|
+
SpriteAtlasAsset.Save(atlasAsset, path);
|
|
30
|
+
|
|
31
|
+
// Step 4: Import the asset into Unity's asset database
|
|
32
|
+
AssetDatabase.ImportAsset(path);
|
|
33
|
+
|
|
34
|
+
Debug.Log($"Created and saved atlas at {path}");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Creates an atlas with automatic folder-based organization.
|
|
39
|
+
/// </summary>
|
|
40
|
+
public static void CreateAtlasFromFolder(string folderPath, string outputPath)
|
|
41
|
+
{
|
|
42
|
+
// Find all sprites in the folder
|
|
43
|
+
string[] guids = AssetDatabase.FindAssets("t:Sprite", new[] { folderPath });
|
|
44
|
+
|
|
45
|
+
Object[] sprites = new Object[guids.Length];
|
|
46
|
+
for (int i = 0; i < guids.Length; i++)
|
|
47
|
+
{
|
|
48
|
+
string assetPath = AssetDatabase.GUIDToAssetPath(guids[i]);
|
|
49
|
+
sprites[i] = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Create and save the atlas
|
|
53
|
+
CreateAndSaveAtlas(outputPath, sprites);
|
|
54
|
+
|
|
55
|
+
// Configure via importer (two-step V2 pattern)
|
|
56
|
+
ConfigureViaImporter(outputPath);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// Configures an atlas after saving using SpriteAtlasImporter.
|
|
61
|
+
/// This is the correct two-step approach for V2.
|
|
62
|
+
/// </summary>
|
|
63
|
+
private static void ConfigureViaImporter(string atlasPath)
|
|
64
|
+
{
|
|
65
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
66
|
+
|
|
67
|
+
if (importer != null)
|
|
68
|
+
{
|
|
69
|
+
// Configure settings
|
|
70
|
+
importer.includeInBuild = true;
|
|
71
|
+
var packingSettings = importer.packingSettings;
|
|
72
|
+
packingSettings.enableTightPacking = true;
|
|
73
|
+
packingSettings.enableAlphaDilation = false;
|
|
74
|
+
importer.packingSettings = packingSettings;
|
|
75
|
+
|
|
76
|
+
// CRITICAL: Save and reimport to apply changes
|
|
77
|
+
importer.SaveAndReimport();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
/// Updates an existing atlas by adding more sprites.
|
|
83
|
+
/// </summary>
|
|
84
|
+
public static void AddSpritesToExistingAtlas(string atlasPath, Object[] newSprites)
|
|
85
|
+
{
|
|
86
|
+
// Load the existing atlas
|
|
87
|
+
SpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>(atlasPath);
|
|
88
|
+
|
|
89
|
+
if (atlasAsset == null)
|
|
90
|
+
{
|
|
91
|
+
Debug.LogError($"Could not load atlas at {atlasPath}");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Add new sprites
|
|
96
|
+
if (newSprites != null && newSprites.Length > 0)
|
|
97
|
+
{
|
|
98
|
+
atlasAsset.Add(newSprites);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Save changes
|
|
102
|
+
SpriteAtlasAsset.Save(atlasAsset, atlasPath);
|
|
103
|
+
AssetDatabase.ImportAsset(atlasPath);
|
|
104
|
+
|
|
105
|
+
Debug.Log($"Added {newSprites.Length} sprites to atlas at {atlasPath}");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor.U2D;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using Unity.Collections;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Base class for implementing custom sprite packing algorithms.
|
|
8
|
+
/// Extend this class to create specialized packing strategies beyond Unity's default algorithms.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class CustomSpritePacker : ScriptablePacker
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Required: Implement packing logic.
|
|
14
|
+
/// This method is called during atlas building to determine sprite positions.
|
|
15
|
+
/// </summary>
|
|
16
|
+
/// <param name="config">Packing configuration settings</param>
|
|
17
|
+
/// <param name="setting">Texture settings for the atlas</param>
|
|
18
|
+
/// <param name="input">Input data containing sprites, textures, and vertex data</param>
|
|
19
|
+
/// <returns>True if packing succeeded, false otherwise</returns>
|
|
20
|
+
public override bool Pack(SpriteAtlasPackingSettings config,
|
|
21
|
+
SpriteAtlasTextureSettings setting,
|
|
22
|
+
PackerData input)
|
|
23
|
+
{
|
|
24
|
+
// Access input data
|
|
25
|
+
NativeArray<SpriteData> sprites = input.spriteData;
|
|
26
|
+
NativeArray<TextureData> textures = input.textureData;
|
|
27
|
+
NativeArray<Color32> colors = input.colorData;
|
|
28
|
+
NativeArray<int> indices = input.indexData;
|
|
29
|
+
NativeArray<Vector2> vertices = input.vertexData;
|
|
30
|
+
|
|
31
|
+
// Implement packing algorithm
|
|
32
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
33
|
+
{
|
|
34
|
+
SpriteData sprite = sprites[i];
|
|
35
|
+
|
|
36
|
+
// Set output position and page
|
|
37
|
+
sprite.output.x = CalculateX(i);
|
|
38
|
+
sprite.output.y = CalculateY(i);
|
|
39
|
+
sprite.output.page = CalculatePage(i);
|
|
40
|
+
sprite.output.rot = PackTransform.None;
|
|
41
|
+
|
|
42
|
+
sprites[i] = sprite;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true; // Return true if packing succeeded
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
/// Optional: Implement fitting without texture creation.
|
|
50
|
+
/// This method is used to determine if sprites fit within the atlas bounds.
|
|
51
|
+
/// </summary>
|
|
52
|
+
protected override bool Fit(SpriteAtlasPackingSettings config,
|
|
53
|
+
SpriteAtlasTextureSettings setting,
|
|
54
|
+
PackerData input)
|
|
55
|
+
{
|
|
56
|
+
// Implement fit algorithm (optional)
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#region Helper Methods
|
|
61
|
+
|
|
62
|
+
private int CalculateX(int index)
|
|
63
|
+
{
|
|
64
|
+
// Custom X position calculation
|
|
65
|
+
return index * 100;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private int CalculateY(int index)
|
|
69
|
+
{
|
|
70
|
+
// Custom Y position calculation
|
|
71
|
+
return (index / 10) * 100;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private int CalculatePage(int index)
|
|
75
|
+
{
|
|
76
|
+
// Page assignment logic
|
|
77
|
+
return index / 64;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#endregion
|
|
81
|
+
}
|