@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,190 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Demonstrates why you should NOT pack atlases during runtime builds.
|
|
7
|
+
/// Packed atlases during build time are already optimized for the target platform.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public static class DontPackInRuntimeBuildsDocumentation
|
|
10
|
+
{
|
|
11
|
+
/// <summary>
|
|
12
|
+
/// ❌ WRONG: Attempting to pack atlases during a runtime build.
|
|
13
|
+
/// This is unnecessary and can cause issues because:
|
|
14
|
+
/// 1. Atlases should be packed at editor time (prebuild)
|
|
15
|
+
/// 2. Runtime builds don't have access to all source assets
|
|
16
|
+
/// 3. It slows down the build process significantly
|
|
17
|
+
/// </summary>
|
|
18
|
+
public static void Wrong_PackDuringRuntimeBuild()
|
|
19
|
+
{
|
|
20
|
+
// This is WRONG - do not pack during runtime build
|
|
21
|
+
|
|
22
|
+
// ❌ BAD: Calling PackAtlases in a build callback
|
|
23
|
+
// public class MyBuildProcessor : IPostprocessBuildWithReport
|
|
24
|
+
// {
|
|
25
|
+
// public void OnPostprocessBuild(BuildTarget target, string path)
|
|
26
|
+
// {
|
|
27
|
+
// // Don't do this!
|
|
28
|
+
// SpriteAtlasUtility.PackAtlases(atlases, BuildTarget.NoAPI);
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
// ❌ BAD: Using SpriteAtlasUtility.PackAtlases in a runtime build
|
|
33
|
+
// This method is for editor preview only, not for build-time packing
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// ❌ WRONG: Calling SaveAndReimport() during a build.
|
|
38
|
+
/// Modifying assets during build can cause unpredictable behavior.
|
|
39
|
+
/// </summary>
|
|
40
|
+
public static void Wrong_ModifyDuringBuild()
|
|
41
|
+
{
|
|
42
|
+
// This is WRONG - do not modify assets during build
|
|
43
|
+
|
|
44
|
+
// ❌ BAD: Saving asset database during build
|
|
45
|
+
// AssetDatabase.SaveAssets();
|
|
46
|
+
// AssetDatabase.ImportAsset(path);
|
|
47
|
+
// importer.SaveAndReimport(); // Don't do this in build!
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// ✅ CORRECT: Pack atlases during prebuild, not runtime.
|
|
52
|
+
/// Use IPreprocessBuildWithReport to pack atlases before the build starts.
|
|
53
|
+
/// </summary>
|
|
54
|
+
public static void Correct_PackDuringPrebuild()
|
|
55
|
+
{
|
|
56
|
+
// ✅ CORRECT: Implement IPreprocessBuildWithReport for packing
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
public class AtlasPacker : IPreprocessBuildWithReport
|
|
60
|
+
{
|
|
61
|
+
public int callbackOrder => 0;
|
|
62
|
+
|
|
63
|
+
public void OnPreprocessBuild(BuildTarget target, string path)
|
|
64
|
+
{
|
|
65
|
+
// Find and pack all atlases before build
|
|
66
|
+
string[] guids = AssetDatabase.FindAssets("t:SpriteAtlasAsset", new[] { "Assets" });
|
|
67
|
+
var atlases = new SpriteAtlasAsset[guids.Length];
|
|
68
|
+
|
|
69
|
+
for (int i = 0; i < guids.Length; i++)
|
|
70
|
+
{
|
|
71
|
+
atlases[i] = AssetDatabase.LoadAssetAtPath<SpriteAtlasAsset>(
|
|
72
|
+
AssetDatabase.GUIDToAssetPath(guids[i]));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Pack is optional here - build-time packing happens automatically
|
|
76
|
+
// SpriteAtlasUtility.PackAtlases(atlases, BuildTarget.NoAPI);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
*/
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// <summary>
|
|
83
|
+
/// ✅ CORRECT: Use prebuild pipeline for atlas generation.
|
|
84
|
+
/// This is the recommended approach for all atlas operations.
|
|
85
|
+
/// </summary>
|
|
86
|
+
public static void Correct_UsePrebuildPipeline()
|
|
87
|
+
{
|
|
88
|
+
// ✅ Implement IPreprocessBuildWithReport for:
|
|
89
|
+
// - Atlas generation
|
|
90
|
+
// - Atlas configuration
|
|
91
|
+
// - Batch packing
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
[InitializeOnLoad]
|
|
95
|
+
public class MyAtlasPreprocessor
|
|
96
|
+
{
|
|
97
|
+
static MyAtlasPreprocessor()
|
|
98
|
+
{
|
|
99
|
+
EditorApplication.wantsToQuit += () =>
|
|
100
|
+
{
|
|
101
|
+
// Clean up any temporary assets before quit
|
|
102
|
+
return true;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public class MyBuildProcessor : IPreprocessBuildWithReport
|
|
108
|
+
{
|
|
109
|
+
public int callbackOrder => 0;
|
|
110
|
+
|
|
111
|
+
public void OnPreprocessBuild(BuildTarget target, string path)
|
|
112
|
+
{
|
|
113
|
+
// Generate or update atlases here
|
|
114
|
+
// This runs BEFORE the build starts
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
*/
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// <summary>
|
|
121
|
+
/// ✅ CORRECT: For runtime loading, use SpriteAtlasManager with late-binding.
|
|
122
|
+
/// Load atlases on-demand at runtime using Addressables or AssetBundles.
|
|
123
|
+
/// </summary>
|
|
124
|
+
public static void Correct_RuntimeLateBinding()
|
|
125
|
+
{
|
|
126
|
+
// ✅ Use SpriteAtlasManager for runtime atlas loading
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
public class RuntimeAtlasLoader : MonoBehaviour
|
|
130
|
+
{
|
|
131
|
+
private void Awake()
|
|
132
|
+
{
|
|
133
|
+
// Register for late-binding
|
|
134
|
+
SpriteAtlasManager.atlasRegistrationNeeded += OnAtlasRegistrationNeeded;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private void OnAtlasRegistrationNeeded(Sprite sprite)
|
|
138
|
+
{
|
|
139
|
+
// Load the appropriate atlas using Addressables or AssetBundles
|
|
140
|
+
// This runs at runtime, not during build
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
*/
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/// <summary>
|
|
148
|
+
/// Summary of when to pack atlases:
|
|
149
|
+
///
|
|
150
|
+
/// Editor Time (✅ DO):
|
|
151
|
+
/// - IPreprocessBuildWithReport.OnPreprocessBuild()
|
|
152
|
+
/// - Manual packing via SpriteAtlasUtility.PackAtlases() for preview
|
|
153
|
+
///
|
|
154
|
+
/// Build Time (❌ DON'T):
|
|
155
|
+
/// - IPostprocessBuildWithReport.OnPostprocessBuild()
|
|
156
|
+
/// - Any time during actual build process
|
|
157
|
+
///
|
|
158
|
+
/// Runtime (✅ DO):
|
|
159
|
+
/// - Load atlases on-demand using SpriteAtlasManager
|
|
160
|
+
/// - Use Addressables or AssetBundles for dynamic loading
|
|
161
|
+
/// </summary>
|
|
162
|
+
public static class PackingTimeline
|
|
163
|
+
{
|
|
164
|
+
/// <summary>
|
|
165
|
+
/// Editor: Prebuild - Pack atlases here ✅
|
|
166
|
+
/// </summary>
|
|
167
|
+
public static void Pack_Editor_Prebuild()
|
|
168
|
+
{
|
|
169
|
+
// IPreprocessBuildWithReport.OnPreprocessBuild()
|
|
170
|
+
// This is the correct time to pack atlases
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/// <summary>
|
|
174
|
+
/// Build: Build process - Do NOT pack here ❌
|
|
175
|
+
/// </summary>
|
|
176
|
+
public static void Pack_Build_Process()
|
|
177
|
+
{
|
|
178
|
+
// IPostprocessBuildWithReport.OnPostprocessBuild()
|
|
179
|
+
// Atlases are already packed at this point
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/// <summary>
|
|
183
|
+
/// Runtime: Late-binding - Load atlases on-demand ✅
|
|
184
|
+
/// </summary>
|
|
185
|
+
public static void Pack_Runtime_LateBinding()
|
|
186
|
+
{
|
|
187
|
+
// SpriteAtlasManager.atlasRegistrationNeeded
|
|
188
|
+
// Load atlases as needed during gameplay
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEditor.U2D;
|
|
5
|
+
using UnityEngine.U2D;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Demonstrates what NOT to do when scripting SpriteAtlases in editor code.
|
|
9
|
+
/// This file shows common mistakes and their consequences.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public static class DontScriptSpriteAtlasInEditor
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// ❌ WRONG: Creating SpriteAtlas directly in editor code.
|
|
15
|
+
/// SpriteAtlas is a runtime-only type. This will fail at compile time or runtime.
|
|
16
|
+
/// </summary>
|
|
17
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
18
|
+
public static void Wrong_CreateSpriteAtlasDirectly()
|
|
19
|
+
{
|
|
20
|
+
// This is WRONG - SpriteAtlas cannot be constructed in editor code
|
|
21
|
+
// SpriteAtlas atlas = new SpriteAtlas(); // Compile error!
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
/// ❌ WRONG: Using AssetDatabase.LoadAssetAtPath<SpriteAtlas>() in editor.
|
|
26
|
+
/// Use SpriteAtlasAsset for editor authoring, not SpriteAtlas.
|
|
27
|
+
/// </summary>
|
|
28
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
29
|
+
public static void Wrong_LoadSpriteAtlasInEditor()
|
|
30
|
+
{
|
|
31
|
+
// This is WRONG - SpriteAtlas is runtime-only
|
|
32
|
+
// SpriteAtlas atlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>("path/to/atlas.spriteatlas"); // Runtime error!
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
/// ❌ WRONG: Modifying SpriteAtlas in editor scripts.
|
|
37
|
+
/// SpriteAtlas is read-only at runtime and cannot be created in editor.
|
|
38
|
+
/// </summary>
|
|
39
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
40
|
+
public static void Wrong_ModifySpriteAtlasInEditor()
|
|
41
|
+
{
|
|
42
|
+
// This is WRONG - cannot modify SpriteAtlas in editor
|
|
43
|
+
// atlas.Add(sprites); // Compile error!
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// ❌ WRONG: Using deprecated SpriteAtlasAsset methods.
|
|
48
|
+
/// Use the two-step pattern with SpriteAtlasImporter instead.
|
|
49
|
+
/// </summary>
|
|
50
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
51
|
+
public static void Wrong_UseDeprecatedMethods()
|
|
52
|
+
{
|
|
53
|
+
// This is WRONG - deprecated methods should not be used
|
|
54
|
+
// SpriteAtlasAsset atlas = new SpriteAtlasAsset();
|
|
55
|
+
// atlas.SetBuildSettings(...); // Deprecated!
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// ❌ WRONG: Modifying importer without calling SaveAndReimport().
|
|
60
|
+
/// Changes to SpriteAtlasImporter are not applied until you save and reimport.
|
|
61
|
+
/// </summary>
|
|
62
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
63
|
+
public static void Wrong_ModifyWithoutSaving()
|
|
64
|
+
{
|
|
65
|
+
// This is WRONG - changes won't be saved
|
|
66
|
+
// SpriteAtlasImporter importer = ...;
|
|
67
|
+
// importer.includeInBuild = true; // Not applied!
|
|
68
|
+
// No SaveAndReimport() called!
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// ❌ WRONG: Confusing authoring vs runtime contexts.
|
|
73
|
+
/// SpriteAtlasAsset (editor) and SpriteAtlas (runtime) are different types.
|
|
74
|
+
/// </summary>
|
|
75
|
+
[System.Obsolete("This is incorrect - do not use")]
|
|
76
|
+
public static void Wrong_ConfuseAuthoringVsRuntime()
|
|
77
|
+
{
|
|
78
|
+
// This is WRONG - mixing contexts
|
|
79
|
+
// SpriteAtlasAsset asset = ...;
|
|
80
|
+
// SpriteAtlas runtime = asset; // Type mismatch!
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
/// CORRECT: The proper way to work with SpriteAtlases in editor code.
|
|
86
|
+
/// </summary>
|
|
87
|
+
public static class CorrectEditorPattern
|
|
88
|
+
{
|
|
89
|
+
/// <summary>
|
|
90
|
+
/// Create and configure an atlas using the correct two-step V2 pattern.
|
|
91
|
+
/// </summary>
|
|
92
|
+
public static void CreateAndConfigureAtlas(string path, Object[] sprites)
|
|
93
|
+
{
|
|
94
|
+
// Step 1: Create with SpriteAtlasAsset (editor-only)
|
|
95
|
+
SpriteAtlasAsset asset = new SpriteAtlasAsset();
|
|
96
|
+
asset.Add(sprites);
|
|
97
|
+
SpriteAtlasAsset.Save(asset, path);
|
|
98
|
+
|
|
99
|
+
// Step 2: Import and configure via SpriteAtlasImporter
|
|
100
|
+
AssetDatabase.ImportAsset(path);
|
|
101
|
+
|
|
102
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(path) as SpriteAtlasImporter;
|
|
103
|
+
if (importer != null)
|
|
104
|
+
{
|
|
105
|
+
importer.includeInBuild = true;
|
|
106
|
+
var packingSettings = importer.packingSettings;
|
|
107
|
+
packingSettings.enableTightPacking = true;
|
|
108
|
+
importer.packingSettings = packingSettings;
|
|
109
|
+
|
|
110
|
+
// CRITICAL: Save and reimport to apply changes
|
|
111
|
+
importer.SaveAndReimport();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Demonstrates proper editor configuration for SpriteAtlas V2.
|
|
8
|
+
/// Always use SpriteAtlasImporter for all settings in editor code.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public static class EditorConfigurationExample
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Configures an existing atlas asset with proper editor settings.
|
|
14
|
+
/// This is the correct pattern - create with SpriteAtlasAsset, then configure via SpriteAtlasImporter.
|
|
15
|
+
/// </summary>
|
|
16
|
+
public static void ConfigureSpriteAtlas(string atlasPath)
|
|
17
|
+
{
|
|
18
|
+
// Step 1: Ensure Sprite Packer is enabled
|
|
19
|
+
EditorSettings.spritePackerMode = SpritePackerMode.SpriteAtlasV2;
|
|
20
|
+
|
|
21
|
+
// Step 2: Get the importer for configuration
|
|
22
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
23
|
+
|
|
24
|
+
if (importer == null)
|
|
25
|
+
{
|
|
26
|
+
Debug.LogError($"Could not get SpriteAtlasImporter for {atlasPath}");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Step 3: Configure texture settings via importer
|
|
31
|
+
var textureSettings = importer.textureSettings;
|
|
32
|
+
textureSettings.generateMipMaps = false;
|
|
33
|
+
textureSettings.filterMode = FilterMode.Bilinear;
|
|
34
|
+
importer.textureSettings = textureSettings;
|
|
35
|
+
|
|
36
|
+
// Step 4: Configure packing settings
|
|
37
|
+
var packingSettings = importer.packingSettings;
|
|
38
|
+
packingSettings.padding = 2;
|
|
39
|
+
packingSettings.enableRotation = true;
|
|
40
|
+
packingSettings.enableTightPacking = true;
|
|
41
|
+
|
|
42
|
+
// Step 5: Configure platform settings
|
|
43
|
+
var platformSettings = importer.GetPlatformSettings("DefaultTexturePlatform");;
|
|
44
|
+
platformSettings.maxTextureSize = 2048;
|
|
45
|
+
platformSettings.format = TextureImporterFormat.ASTC_6x6;
|
|
46
|
+
platformSettings.compressionQuality = 100;
|
|
47
|
+
importer.GetPlatformSettings("DefaultTexturePlatform");
|
|
48
|
+
|
|
49
|
+
// Step 6: Set build inclusion
|
|
50
|
+
importer.includeInBuild = true;
|
|
51
|
+
|
|
52
|
+
// Step 7: CRITICAL - Save and reimport to apply changes
|
|
53
|
+
importer.SaveAndReimport();
|
|
54
|
+
|
|
55
|
+
Debug.Log($"Configured atlas at {atlasPath}");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// Configures platform-specific settings for multiple platforms.
|
|
60
|
+
/// </summary>
|
|
61
|
+
public static void ConfigurePlatformSettings(string atlasPath)
|
|
62
|
+
{
|
|
63
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
64
|
+
|
|
65
|
+
// Mobile platform (Android/iOS)
|
|
66
|
+
importer.SetPlatformSettings(new TextureImporterPlatformSettings
|
|
67
|
+
{
|
|
68
|
+
name = "Android",
|
|
69
|
+
maxTextureSize = 1024,
|
|
70
|
+
format = TextureImporterFormat.ETC2_RGB4,
|
|
71
|
+
compressionQuality = 100
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
importer.SetPlatformSettings(new TextureImporterPlatformSettings
|
|
75
|
+
{
|
|
76
|
+
name = "iOS",
|
|
77
|
+
maxTextureSize = 1024,
|
|
78
|
+
format = TextureImporterFormat.ASTC_6x6,
|
|
79
|
+
compressionQuality = 100
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Desktop platform (Windows/Mac/Linux)
|
|
83
|
+
importer.SetPlatformSettings(new TextureImporterPlatformSettings
|
|
84
|
+
{
|
|
85
|
+
name = "Standalone",
|
|
86
|
+
maxTextureSize = 1024,
|
|
87
|
+
format = TextureImporterFormat.DXT5,
|
|
88
|
+
compressionQuality = 100
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
// Save and reimport
|
|
93
|
+
importer.SaveAndReimport();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using UnityEditor.U2D;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Demonstrates enabling and configuring Sprite Packer for SpriteAtlases.
|
|
8
|
+
/// Proper packing configuration is essential for efficient atlas usage.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public static class EnableSpritePackingExample
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Enables Sprite Packer mode in Project Settings.
|
|
14
|
+
/// This must be done before creating atlases.
|
|
15
|
+
/// </summary>
|
|
16
|
+
public static void EnableSpritePacker()
|
|
17
|
+
{
|
|
18
|
+
EditorSettings.spritePackerMode = SpritePackerMode.SpriteAtlasV2;
|
|
19
|
+
Debug.Log("Sprite Packer V2 enabled");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Configures packing settings for an atlas.
|
|
24
|
+
/// Tight packing reduces texture memory usage.
|
|
25
|
+
/// </summary>
|
|
26
|
+
public static void ConfigurePackingSettings(string atlasPath)
|
|
27
|
+
{
|
|
28
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
29
|
+
if (importer == null)
|
|
30
|
+
return;
|
|
31
|
+
|
|
32
|
+
// Enable tight packing for better space utilization
|
|
33
|
+
var packingSettings = importer.packingSettings;
|
|
34
|
+
packingSettings.enableTightPacking = true;
|
|
35
|
+
importer.packingSettings = packingSettings;
|
|
36
|
+
|
|
37
|
+
importer.SaveAndReimport();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// Configures packing settings with rotation enabled.
|
|
42
|
+
/// Rotation can significantly improve packing density for irregular sprites.
|
|
43
|
+
/// </summary>
|
|
44
|
+
public static void EnableRotationPacking(string atlasPath)
|
|
45
|
+
{
|
|
46
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
47
|
+
if (importer == null)
|
|
48
|
+
return;
|
|
49
|
+
|
|
50
|
+
var packingSettings = importer.packingSettings;
|
|
51
|
+
packingSettings.enableRotation = true;
|
|
52
|
+
importer.packingSettings = packingSettings;
|
|
53
|
+
|
|
54
|
+
importer.SaveAndReimport();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Configures packing settings with padding.
|
|
59
|
+
/// Add padding to prevent texture bleeding between adjacent sprites.
|
|
60
|
+
/// </summary>
|
|
61
|
+
public static void ConfigurePackingWithPadding(string atlasPath, int paddingPixels)
|
|
62
|
+
{
|
|
63
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
64
|
+
if (importer == null)
|
|
65
|
+
return;
|
|
66
|
+
|
|
67
|
+
var packingSettings = importer.packingSettings;
|
|
68
|
+
packingSettings.padding = 2;
|
|
69
|
+
importer.packingSettings = packingSettings;
|
|
70
|
+
|
|
71
|
+
importer.SaveAndReimport();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// Configures packing settings for UI atlases.
|
|
76
|
+
/// UI sprites typically need consistent positioning without rotation.
|
|
77
|
+
/// </summary>
|
|
78
|
+
public static void ConfigureUIPacking(string atlasPath)
|
|
79
|
+
{
|
|
80
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
81
|
+
if (importer == null)
|
|
82
|
+
return;
|
|
83
|
+
|
|
84
|
+
// UI sprites usually shouldn't be rotated
|
|
85
|
+
var packingSettings = importer.packingSettings;
|
|
86
|
+
packingSettings.padding = 2;
|
|
87
|
+
packingSettings.enableTightPacking = false;
|
|
88
|
+
packingSettings.enableRotation = false;
|
|
89
|
+
packingSettings.enableAlphaDilation = false;
|
|
90
|
+
importer.packingSettings = packingSettings;
|
|
91
|
+
|
|
92
|
+
importer.SaveAndReimport();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// Configures packing settings for character/animation atlases.
|
|
97
|
+
/// Animation frames need consistent positioning across frames.
|
|
98
|
+
/// </summary>
|
|
99
|
+
public static void ConfigureAnimationPacking(string atlasPath)
|
|
100
|
+
{
|
|
101
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(atlasPath) as SpriteAtlasImporter;
|
|
102
|
+
if (importer == null)
|
|
103
|
+
return;
|
|
104
|
+
|
|
105
|
+
// UI sprites usually shouldn't be rotated
|
|
106
|
+
var packingSettings = importer.packingSettings;
|
|
107
|
+
packingSettings.padding = 2;
|
|
108
|
+
packingSettings.enableTightPacking = true;
|
|
109
|
+
packingSettings.enableRotation = false;
|
|
110
|
+
packingSettings.enableAlphaDilation = false;
|
|
111
|
+
importer.packingSettings = packingSettings;
|
|
112
|
+
|
|
113
|
+
importer.SaveAndReimport();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// <summary>
|
|
118
|
+
/// Editor window for batch configuring sprite packing settings.
|
|
119
|
+
/// </summary>
|
|
120
|
+
public class ConfigurePackingWindow : EditorWindow
|
|
121
|
+
{
|
|
122
|
+
private string _atlasFolder = "Assets/Atlases";
|
|
123
|
+
private bool _tightPacking = true;
|
|
124
|
+
private bool _allowRotation = false;
|
|
125
|
+
private int _padding = 2;
|
|
126
|
+
|
|
127
|
+
[MenuItem("Tools/Configure Sprite Packing")]
|
|
128
|
+
public static void ShowWindow()
|
|
129
|
+
{
|
|
130
|
+
GetWindow<ConfigurePackingWindow>("Configure Packing");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private void OnGUI()
|
|
134
|
+
{
|
|
135
|
+
EditorGUILayout.LabelField("Batch Configure Packing", EditorStyles.boldLabel);
|
|
136
|
+
|
|
137
|
+
_atlasFolder = EditorGUILayout.TextField("Atlas Folder", _atlasFolder);
|
|
138
|
+
_tightPacking = EditorGUILayout.Toggle("Tight Packing", _tightPacking);
|
|
139
|
+
_allowRotation = EditorGUILayout.Toggle("Allow Rotation", _allowRotation);
|
|
140
|
+
_padding = EditorGUILayout.IntField("Padding (pixels)", _padding);
|
|
141
|
+
|
|
142
|
+
if (GUILayout.Button("Configure Atlases"))
|
|
143
|
+
{
|
|
144
|
+
BatchConfigure();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private void BatchConfigure()
|
|
149
|
+
{
|
|
150
|
+
string[] guids = AssetDatabase.FindAssets("t:SpriteAtlasAsset", new[] { _atlasFolder });
|
|
151
|
+
|
|
152
|
+
foreach (string guid in guids)
|
|
153
|
+
{
|
|
154
|
+
string path = AssetDatabase.GUIDToAssetPath(guid);
|
|
155
|
+
SpriteAtlasImporter importer = AssetImporter.GetAtPath(path) as SpriteAtlasImporter;
|
|
156
|
+
|
|
157
|
+
if (importer != null)
|
|
158
|
+
{
|
|
159
|
+
var packingSettings = importer.packingSettings;
|
|
160
|
+
packingSettings.padding = _padding;
|
|
161
|
+
packingSettings.enableTightPacking = _tightPacking;
|
|
162
|
+
packingSettings.enableRotation = _allowRotation;
|
|
163
|
+
packingSettings.enableAlphaDilation = false;
|
|
164
|
+
importer.packingSettings = packingSettings;
|
|
165
|
+
importer.SaveAndReimport();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Debug.Log($"Configured packing for {guids.Length} atlases");
|
|
170
|
+
AssetDatabase.Refresh();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// [UNITY-SKILL:SPRITEATLAS]
|
|
2
|
+
using UnityEditor.U2D;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using Unity.Collections;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Simple grid-based sprite packer that arranges sprites in a uniform grid pattern.
|
|
8
|
+
/// Sprites are placed row by row from left to right, top to bottom.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class GridSpritePacker : ScriptablePacker
|
|
11
|
+
{
|
|
12
|
+
/// <summary>Number of columns in the grid</summary>
|
|
13
|
+
public int columns = 4;
|
|
14
|
+
|
|
15
|
+
/// <summary>Size of each cell in pixels (assumed square)</summary>
|
|
16
|
+
public int cellSize = 256;
|
|
17
|
+
|
|
18
|
+
/// <summary>Padding between sprites in pixels</summary>
|
|
19
|
+
public int padding = 2;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Packs sprites in a grid pattern.
|
|
23
|
+
/// Sprite at index i is placed at column (i % columns) and row (i / columns).
|
|
24
|
+
/// </summary>
|
|
25
|
+
public override bool Pack(SpriteAtlasPackingSettings config,
|
|
26
|
+
SpriteAtlasTextureSettings setting,
|
|
27
|
+
PackerData input)
|
|
28
|
+
{
|
|
29
|
+
NativeArray<SpriteData> sprites = input.spriteData;
|
|
30
|
+
|
|
31
|
+
for (int i = 0; i < sprites.Length; i++)
|
|
32
|
+
{
|
|
33
|
+
SpriteData sprite = sprites[i];
|
|
34
|
+
|
|
35
|
+
// Calculate grid position
|
|
36
|
+
int col = i % columns;
|
|
37
|
+
int row = i / columns;
|
|
38
|
+
|
|
39
|
+
// Set output position with padding
|
|
40
|
+
sprite.output.x = col * (cellSize + padding) + padding;
|
|
41
|
+
sprite.output.y = row * (cellSize + padding) + padding;
|
|
42
|
+
sprite.output.page = 0; // Single page
|
|
43
|
+
sprite.output.rot = PackTransform.None;
|
|
44
|
+
|
|
45
|
+
sprites[i] = sprite;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|