@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,58 @@
|
|
|
1
|
+
# Cloud Code Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Four Execution Models](#four-execution-models)
|
|
6
|
+
- [Cloud Code Modules vs CloudBehaviours](#cloud-code-modules-vs-cloudbehaviours)
|
|
7
|
+
- [Where the details live](#where-the-details-live)
|
|
8
|
+
|
|
9
|
+
Accessed via `CloudCodeService.Instance` (`ICloudCodeService`, namespace `Unity.Services.CloudCode`). Assembly: `Unity.Services.CloudCode`.
|
|
10
|
+
|
|
11
|
+
Call `UnityServices.InitializeAsync()` from `com.unity.services.core` and sign in via `com.unity.services.authentication` before use.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Four Execution Models
|
|
16
|
+
|
|
17
|
+
| Model | Language | Client Method | Deployed as |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| **Scripts** | JavaScript | `CallEndpointAsync` | `.js` files via Deployment Window |
|
|
20
|
+
| **Legacy modules** | C# (.NET 8, up to .NET 10) | generated bindings, or `CallModuleEndpointAsync` | `.ccmr` references to a .NET solution built outside Unity |
|
|
21
|
+
| **Cloud Code modules** | C# (.NET 8; .NET 10 on Unity 6.7+) | generated bindings only | `.ccmu` assets, authored natively in the Editor |
|
|
22
|
+
| **CloudBehaviours** (experimental) | C# (.NET 8; .NET 10 on Unity 6.7+) | generated bindings — `await behaviour.Method(args)` | `.ccmu` assets, authored natively in the Editor |
|
|
23
|
+
|
|
24
|
+
**Recommendation:** Prefer **C#** over JavaScript scripts for production — type safety, generated client
|
|
25
|
+
bindings, and access to NuGet packages. Do not write new scripts; maintain and call existing ones. Prefer authoring
|
|
26
|
+
natively in the Editor (`.ccmu`) over a `.ccmr` reference for new work: the module lives in the project,
|
|
27
|
+
compiles with it, and needs no separate solution. Between Cloud Code modules and CloudBehaviours, see
|
|
28
|
+
the breakdown below.
|
|
29
|
+
|
|
30
|
+
### Cloud Code Modules vs CloudBehaviours
|
|
31
|
+
|
|
32
|
+
Both are C# modules, and both can hold state per scope with `[StateScope]`. They differ in how the client
|
|
33
|
+
reaches them and in whether that state reaches the client on its own:
|
|
34
|
+
|
|
35
|
+
| | Cloud Code modules | CloudBehaviours |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| **Endpoint naming** | one function per `[CloudCodeFunction]` | one generated `[CloudCodeFunction]` per public method you define, named `Behaviour__Method` |
|
|
38
|
+
| **Scoped state** | `[StateScope]` persists public fields per player or session | the same, and public fields also synchronize to clients |
|
|
39
|
+
| **Client updates** | request/response; subscribe by hand for push messages | synchronized fields and push events arrive on the generated bindings |
|
|
40
|
+
| **Client code** | you write the call and deserialize the result | the bindings partial is generated from the cloud class |
|
|
41
|
+
| **Requires** | `com.unity.services.cloudcode` `3.0.0`+, Unity 6000.5+ | `com.unity.services.cloudcode` `3.1.0-exp.1`+, Unity 6000.5+ |
|
|
42
|
+
|
|
43
|
+
**Use CloudBehaviours when clients need to see the state** — shared match state, an inventory the client
|
|
44
|
+
displays, per-player views of a shared secret, or a server-owned timer whose deadline the client shows.
|
|
45
|
+
The bindings, the synchronization and the push plumbing are generated, so it is less code and less
|
|
46
|
+
error-prone than a module plus hand-written calls and subscriptions.
|
|
47
|
+
|
|
48
|
+
**Use Cloud Code modules when the client only needs the result of a call** — validating a purchase, awarding a
|
|
49
|
+
reward, calling another service, running a trigger on a schedule. Scoped state still works; simpler than
|
|
50
|
+
using CloudBehaviours if there is no need for state synchronization.
|
|
51
|
+
|
|
52
|
+
## Where the details live
|
|
53
|
+
|
|
54
|
+
| Reference | Covers |
|
|
55
|
+
| :-- | :-- |
|
|
56
|
+
| `references/cloud-code-modules.md` | Cloud Code modules (`.ccmu`), legacy modules (`.ccmr`) and scripts — creating a `.ccmu`, the `.ccmu` asset and how the deployed module name is derived, `ICloudCodeService`, subscriptions, triggers, module scope, generated bindings, deployment, error handling |
|
|
57
|
+
| `references/cloud-code-cloudbehaviours.md` | CloudBehaviours — the authoring model, synchronized state, per-viewer projections, timers, access control |
|
|
58
|
+
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
# Cloud Save Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Anti-Hallucination Reference](#anti-hallucination-reference)
|
|
6
|
+
- [Subsystems](#subsystems)
|
|
7
|
+
- [IPlayerDataService Methods](#iplayerdataservice-methods)
|
|
8
|
+
- [ICustomDataService Methods](#icustomdataservice-methods)
|
|
9
|
+
- [IPlayerFilesService Methods](#iplayerfilesservice-methods)
|
|
10
|
+
- [Key Model Types](#key-model-types)
|
|
11
|
+
- [Access Classes](#access-classes)
|
|
12
|
+
- [Code Templates](#code-templates)
|
|
13
|
+
- [Error Handling](#error-handling)
|
|
14
|
+
|
|
15
|
+
Accessed via `CloudSaveService.Instance` (`ICloudSaveService`, namespace `Unity.Services.CloudSave`). Assembly: `Unity.Services.CloudSave`.
|
|
16
|
+
|
|
17
|
+
Call `UnityServices.InitializeAsync()` from `com.unity.services.core` and sign in via `com.unity.services.authentication` before use.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Anti-Hallucination Reference
|
|
22
|
+
|
|
23
|
+
| Correct | Incorrect (do NOT use) |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `SaveAsync` returns `Task<Dictionary<string, string>>` (write lock tokens) | `SaveAsync` returns `Task` (void) |
|
|
26
|
+
| `Item.Value` is `IDeserializable` -- call `.GetAs<T>()` | `Item.Value` is `object` |
|
|
27
|
+
| `SaveAsync(IDictionary<string, object>)` -- uses `IDictionary` | `SaveAsync(Dictionary<string, object>)` -- wrong interface type |
|
|
28
|
+
| `SaveAsync(IDictionary<string, SaveItem>)` -- bundles value + write lock | `SaveAsync(data, Dictionary<string, WriteLockOptions>)` -- no such overload |
|
|
29
|
+
| Custom data is **read-only** from client (no save/delete methods) | Custom data can be written from client |
|
|
30
|
+
| `CloudSaveConflictException` has `Details` list | Only `CloudSaveException` exists for conflicts |
|
|
31
|
+
| `CloudSaveExceptionReason.Conflict` (value 11) | `WriteLockConflict` reason |
|
|
32
|
+
| `Item.Modified` / `Item.Created` are `DateTime?` | `Item.Modified` is `ModifiedMetadata` |
|
|
33
|
+
| `FileItem.Modified` / `FileItem.Created` are `DateTime?` | `FileItem.Modified` is `ModifiedMetadata` |
|
|
34
|
+
| `DeleteAsync(key, Models.Data.Player.DeleteOptions)` -- current API | `DeleteAsync(key, CloudSave.DeleteOptions)` -- deprecated overload |
|
|
35
|
+
| `ICustomDataService` methods require `customDataID` first param | Custom data methods with no ID param |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Subsystems
|
|
40
|
+
|
|
41
|
+
| Subsystem | Access | Description |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `Data.Player` | `CloudSaveService.Instance.Data.Player` | Key-value data for the signed-in player |
|
|
44
|
+
| `Data.Custom` | `CloudSaveService.Instance.Data.Custom` | Game-wide or server-written data; **read-only from client** |
|
|
45
|
+
| `Files.Player` | `CloudSaveService.Instance.Files.Player` | Binary file storage per player |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## IPlayerDataService Methods
|
|
50
|
+
|
|
51
|
+
`CloudSaveService.Instance.Data.Player`
|
|
52
|
+
|
|
53
|
+
**Options namespace:** All option classes (`SaveOptions`, `LoadOptions`, `DeleteOptions`, `DeleteAllOptions`, `ListAllKeysOptions`, `LoadAllOptions`, `QueryOptions`) are in `Unity.Services.CloudSave.Models.Data.Player`. Do **not** confuse with the deprecated root-level `CloudSave.SaveOptions` / `CloudSave.DeleteOptions`.
|
|
54
|
+
|
|
55
|
+
```csharp
|
|
56
|
+
// List all keys belonging to the current player (with metadata).
|
|
57
|
+
Task<List<ItemKey>> ListAllKeysAsync()
|
|
58
|
+
Task<List<ItemKey>> ListAllKeysAsync(ListAllKeysOptions options)
|
|
59
|
+
|
|
60
|
+
// Load specific keys. Returns dictionary of key -> Item.
|
|
61
|
+
Task<Dictionary<string, Item>> LoadAsync(ISet<string> keys)
|
|
62
|
+
Task<Dictionary<string, Item>> LoadAsync(ISet<string> keys, LoadOptions options)
|
|
63
|
+
|
|
64
|
+
// Load all keys for the current player.
|
|
65
|
+
Task<Dictionary<string, Item>> LoadAllAsync()
|
|
66
|
+
Task<Dictionary<string, Item>> LoadAllAsync(LoadAllOptions options)
|
|
67
|
+
|
|
68
|
+
// Save key-value pairs. Returns Dictionary<string, string> mapping each key to its new write-lock token.
|
|
69
|
+
Task<Dictionary<string, string>> SaveAsync(IDictionary<string, object> data)
|
|
70
|
+
Task<Dictionary<string, string>> SaveAsync(IDictionary<string, object> data, SaveOptions options)
|
|
71
|
+
|
|
72
|
+
// Save with per-key write locks bundled via SaveItem.
|
|
73
|
+
Task<Dictionary<string, string>> SaveAsync(IDictionary<string, SaveItem> data)
|
|
74
|
+
Task<Dictionary<string, string>> SaveAsync(IDictionary<string, SaveItem> data, SaveOptions options)
|
|
75
|
+
|
|
76
|
+
// Delete a specific key. Use Models.Data.Player.DeleteOptions (not the deprecated root DeleteOptions).
|
|
77
|
+
Task DeleteAsync(string key, Models.Data.Player.DeleteOptions options)
|
|
78
|
+
|
|
79
|
+
// Delete ALL keys for the current player.
|
|
80
|
+
Task DeleteAllAsync()
|
|
81
|
+
Task DeleteAllAsync(DeleteAllOptions options)
|
|
82
|
+
|
|
83
|
+
// Query player data with field filters.
|
|
84
|
+
Task<List<EntityData>> QueryAsync(Query query, QueryOptions options)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## ICustomDataService Methods
|
|
90
|
+
|
|
91
|
+
`CloudSaveService.Instance.Data.Custom`
|
|
92
|
+
|
|
93
|
+
Read-only from the client. Write via Cloud Code modules or `IAdminClient.CloudSaveData` from the `com.unity.services.apis` package. All methods require a `customDataID` parameter -- the namespace configured in the Unity Dashboard.
|
|
94
|
+
|
|
95
|
+
> **To write Custom Data from the editor or a deploy command**, use `IAdminClient.CloudSaveData.SetCustomItem` /
|
|
96
|
+
> `SetCustomItemBatch`. See `references/apis.md` for setup and code templates. The client SDK has no write
|
|
97
|
+
> path for Custom Data.
|
|
98
|
+
|
|
99
|
+
```csharp
|
|
100
|
+
Task<List<ItemKey>> ListAllKeysAsync(string customDataID)
|
|
101
|
+
Task<Dictionary<string, Item>> LoadAllAsync(string customDataID)
|
|
102
|
+
Task<Dictionary<string, Item>> LoadAsync(string customDataID, ISet<string> keys)
|
|
103
|
+
|
|
104
|
+
// Query across custom data. Uses Models.Data.Custom.QueryOptions.
|
|
105
|
+
Task<List<EntityData>> QueryAsync(Query query, Models.Data.Custom.QueryOptions options = default)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## IPlayerFilesService Methods
|
|
111
|
+
|
|
112
|
+
`CloudSaveService.Instance.Files.Player`
|
|
113
|
+
|
|
114
|
+
Note: File methods use root-level `CloudSave.SaveOptions` and `CloudSave.DeleteOptions` (not the `Models.Data.Player` versions).
|
|
115
|
+
|
|
116
|
+
```csharp
|
|
117
|
+
// List all files for the current player.
|
|
118
|
+
Task<List<FileItem>> ListAllAsync()
|
|
119
|
+
|
|
120
|
+
// Save a file (byte array or stream).
|
|
121
|
+
Task SaveAsync(string key, byte[] bytes, SaveOptions options = default)
|
|
122
|
+
Task SaveAsync(string key, Stream stream, SaveOptions options = default)
|
|
123
|
+
|
|
124
|
+
// Load a file as a byte array.
|
|
125
|
+
Task<byte[]> LoadBytesAsync(string key)
|
|
126
|
+
|
|
127
|
+
// Load a file as a stream.
|
|
128
|
+
Task<Stream> LoadStreamAsync(string key)
|
|
129
|
+
|
|
130
|
+
// Delete a file.
|
|
131
|
+
Task DeleteAsync(string key, DeleteOptions options = default)
|
|
132
|
+
|
|
133
|
+
// Get metadata for a specific file.
|
|
134
|
+
Task<FileItem> GetMetadataAsync(string key)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Key Model Types
|
|
140
|
+
|
|
141
|
+
### `Item` (`Unity.Services.CloudSave.Models`)
|
|
142
|
+
|
|
143
|
+
| Property | Type | Description |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `Key` | `string` | The data key |
|
|
146
|
+
| `Value` | `IDeserializable` | Deserialized value -- call `.GetAs<T>()` or `.GetAsString()` |
|
|
147
|
+
| `WriteLock` | `string` | Current write-lock token (use for optimistic concurrency) |
|
|
148
|
+
| `Created` | `DateTime?` | Creation timestamp |
|
|
149
|
+
| `Modified` | `DateTime?` | Last-modified timestamp |
|
|
150
|
+
|
|
151
|
+
### `ItemKey` (`Unity.Services.CloudSave.Models`)
|
|
152
|
+
|
|
153
|
+
| Property | Type | Description |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `Key` | `string` | The data key |
|
|
156
|
+
| `WriteLock` | `string` | Current write-lock token |
|
|
157
|
+
| `Modified` | `DateTime?` | Last-modified timestamp |
|
|
158
|
+
|
|
159
|
+
### `FileItem` (`Unity.Services.CloudSave.Models`)
|
|
160
|
+
|
|
161
|
+
| Property | Type | Description |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `Key` | `string` | The file key |
|
|
164
|
+
| `Size` | `long` | File size in bytes |
|
|
165
|
+
| `WriteLock` | `string` | Current write-lock token |
|
|
166
|
+
| `ContentType` | `string` | MIME type of the file |
|
|
167
|
+
| `Created` | `DateTime?` | Creation timestamp |
|
|
168
|
+
| `Modified` | `DateTime?` | Last-modified timestamp |
|
|
169
|
+
|
|
170
|
+
### `SaveItem` (`Unity.Services.CloudSave.Models`)
|
|
171
|
+
|
|
172
|
+
Bundles a value and write lock for atomic save-with-lock operations.
|
|
173
|
+
|
|
174
|
+
```csharp
|
|
175
|
+
new SaveItem(value: myObject, writeLock: previousItem.WriteLock)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `Query` (`Unity.Services.CloudSave.Models`)
|
|
179
|
+
|
|
180
|
+
| Property | Type | Description |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `Fields` | `List<FieldFilter>` | Filter conditions (required) |
|
|
183
|
+
| `ReturnKeys` | `HashSet<string>` | Project only these keys in results |
|
|
184
|
+
| `Offset` | `int` | Skip N results (pagination) |
|
|
185
|
+
| `Limit` | `int` | Max results to return |
|
|
186
|
+
| `SampleSize` | `int?` | Random sample size (optional) |
|
|
187
|
+
|
|
188
|
+
### `FieldFilter` (`Unity.Services.CloudSave.Models`)
|
|
189
|
+
|
|
190
|
+
```csharp
|
|
191
|
+
new FieldFilter(key: "level", value: 10, op: FieldFilter.OpOptions.GE, asc: true)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
| `OpOptions` | Meaning |
|
|
195
|
+
|---|---|
|
|
196
|
+
| `EQ` | Equal |
|
|
197
|
+
| `NE` | Not equal |
|
|
198
|
+
| `LT` | Less than |
|
|
199
|
+
| `LE` | Less than or equal |
|
|
200
|
+
| `GT` | Greater than |
|
|
201
|
+
| `GE` | Greater than or equal |
|
|
202
|
+
|
|
203
|
+
### `EntityData` (`Unity.Services.CloudSave.Models`)
|
|
204
|
+
|
|
205
|
+
Query results return `List<EntityData>`, where each entry is one player's matching data.
|
|
206
|
+
|
|
207
|
+
| Property | Type | Description |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| `Id` | `string` | Player ID |
|
|
210
|
+
| `Data` | `List<Item>` | Matching items for this player |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Access Classes
|
|
215
|
+
|
|
216
|
+
Namespace: `Unity.Services.CloudSave.Models.Data.Player`.
|
|
217
|
+
|
|
218
|
+
### `AccessClass` Enum
|
|
219
|
+
|
|
220
|
+
| Value | Meaning |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `Default` (0) | Owner read/write -- private to the player |
|
|
223
|
+
| `Private` (1) | Alias for Default |
|
|
224
|
+
| `Protected` (2) | Owner read, server-only write |
|
|
225
|
+
| `Public` (3) | Any player can read, owner writes |
|
|
226
|
+
|
|
227
|
+
### Read Access Class Options (for Load/ListAllKeys)
|
|
228
|
+
|
|
229
|
+
- `DefaultReadAccessClassOptions()` -- read own Default-class data
|
|
230
|
+
- `PublicReadAccessClassOptions()` -- read own Public-class data
|
|
231
|
+
- `PublicReadAccessClassOptions(string playerId)` -- read **another player's** Public-class data
|
|
232
|
+
- `ProtectedReadAccessClassOptions()` -- read own Protected-class data
|
|
233
|
+
|
|
234
|
+
### Write Access Class Options (for Save/Delete)
|
|
235
|
+
|
|
236
|
+
- `DefaultWriteAccessClassOptions()` -- write to Default-class keys
|
|
237
|
+
- `PublicWriteAccessClassOptions()` -- write to Public-class keys
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Code Templates
|
|
242
|
+
|
|
243
|
+
### Save Player Data (Capture Write Lock Tokens)
|
|
244
|
+
|
|
245
|
+
```csharp
|
|
246
|
+
using Unity.Services.CloudSave;
|
|
247
|
+
using Unity.Services.CloudSave.Models;
|
|
248
|
+
using System.Collections.Generic;
|
|
249
|
+
|
|
250
|
+
var data = new Dictionary<string, object>
|
|
251
|
+
{
|
|
252
|
+
{ "level", 10 },
|
|
253
|
+
{ "gold", 500 },
|
|
254
|
+
{ "inventory", new string[] { "sword", "shield" } }
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// SaveAsync returns write-lock tokens for each saved key
|
|
258
|
+
Dictionary<string, string> writeLocks = await CloudSaveService.Instance.Data.Player.SaveAsync(data);
|
|
259
|
+
// writeLocks["level"] == "new-lock-token-for-level", etc.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Load Specific Keys
|
|
263
|
+
|
|
264
|
+
```csharp
|
|
265
|
+
var keys = new HashSet<string> { "level", "gold" };
|
|
266
|
+
var result = await CloudSaveService.Instance.Data.Player.LoadAsync(keys);
|
|
267
|
+
|
|
268
|
+
if (result.TryGetValue("level", out var levelItem))
|
|
269
|
+
{
|
|
270
|
+
int level = levelItem.Value.GetAs<int>();
|
|
271
|
+
Debug.Log($"Level: {level}, Modified: {levelItem.Modified}");
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Save with Write Lock Using SaveItem
|
|
276
|
+
|
|
277
|
+
```csharp
|
|
278
|
+
using Unity.Services.CloudSave.Models;
|
|
279
|
+
|
|
280
|
+
// First load to get the current write lock
|
|
281
|
+
var items = await CloudSaveService.Instance.Data.Player.LoadAsync(new HashSet<string> { "gold" });
|
|
282
|
+
var goldItem = items["gold"];
|
|
283
|
+
|
|
284
|
+
// Bundle value + write lock in SaveItem -- fails if another client updated in the meantime
|
|
285
|
+
var saveData = new Dictionary<string, SaveItem>
|
|
286
|
+
{
|
|
287
|
+
{ "gold", new SaveItem(value: 600, writeLock: goldItem.WriteLock) }
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
Dictionary<string, string> newLocks = await CloudSaveService.Instance.Data.Player.SaveAsync(saveData);
|
|
291
|
+
// newLocks["gold"] is the updated write-lock token
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Handle Write-Lock Conflicts
|
|
295
|
+
|
|
296
|
+
```csharp
|
|
297
|
+
using Unity.Services.CloudSave;
|
|
298
|
+
|
|
299
|
+
try
|
|
300
|
+
{
|
|
301
|
+
await CloudSaveService.Instance.Data.Player.SaveAsync(saveData);
|
|
302
|
+
}
|
|
303
|
+
catch (CloudSaveConflictException ex)
|
|
304
|
+
{
|
|
305
|
+
foreach (var detail in ex.Details)
|
|
306
|
+
{
|
|
307
|
+
Debug.LogError($"Conflict on '{detail.Key}': " +
|
|
308
|
+
$"you sent lock '{detail.AttemptedWriteLock}', " +
|
|
309
|
+
$"server has '{detail.ExistingWriteLock}'");
|
|
310
|
+
}
|
|
311
|
+
// Reload, merge, and retry
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Delete a Key
|
|
316
|
+
|
|
317
|
+
```csharp
|
|
318
|
+
using Unity.Services.CloudSave.Models.Data.Player;
|
|
319
|
+
|
|
320
|
+
// Delete with write-lock check
|
|
321
|
+
var options = new DeleteOptions { WriteLock = knownWriteLock };
|
|
322
|
+
await CloudSaveService.Instance.Data.Player.DeleteAsync("gold", options);
|
|
323
|
+
|
|
324
|
+
// Delete ALL player data
|
|
325
|
+
await CloudSaveService.Instance.Data.Player.DeleteAllAsync();
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Save and Load with Access Classes (Public, Default, Protected)
|
|
329
|
+
|
|
330
|
+
> **Namespace note:** `SaveOptions`, `LoadOptions`, and `DeleteOptions` exist in both
|
|
331
|
+
> `Unity.Services.CloudSave` (root) and `Unity.Services.CloudSave.Models.Data.Player`.
|
|
332
|
+
> The access-class overloads live in `Models.Data.Player`. If you import both namespaces,
|
|
333
|
+
> use fully qualified names or a `using` alias to avoid ambiguity.
|
|
334
|
+
|
|
335
|
+
```csharp
|
|
336
|
+
using Unity.Services.CloudSave.Models.Data.Player;
|
|
337
|
+
|
|
338
|
+
// Save data as Public (other players can read it)
|
|
339
|
+
var publicData = new Dictionary<string, object> { { "displayName", "Hero123" }, { "rank", 42 } };
|
|
340
|
+
var publicOptions = new SaveOptions(new PublicWriteAccessClassOptions());
|
|
341
|
+
await CloudSaveService.Instance.Data.Player.SaveAsync(publicData, publicOptions);
|
|
342
|
+
|
|
343
|
+
// Read another player's Public-class data
|
|
344
|
+
var readOptions = new LoadOptions(new PublicReadAccessClassOptions(otherPlayerId));
|
|
345
|
+
var otherPlayerData = await CloudSaveService.Instance.Data.Player.LoadAsync(
|
|
346
|
+
new HashSet<string> { "displayName", "rank" }, readOptions);
|
|
347
|
+
Debug.Log($"Other player name: {otherPlayerData["displayName"].Value.GetAs<string>()}");
|
|
348
|
+
|
|
349
|
+
// Read own Protected-class data (written by server/Cloud Code)
|
|
350
|
+
var protectedOptions = new LoadOptions(new ProtectedReadAccessClassOptions());
|
|
351
|
+
var serverData = await CloudSaveService.Instance.Data.Player.LoadAllAsync(
|
|
352
|
+
new LoadAllOptions(new ProtectedReadAccessClassOptions()));
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Read Custom Data (Game-Wide, Read-Only)
|
|
356
|
+
|
|
357
|
+
```csharp
|
|
358
|
+
// Custom data is read-only from client -- written via Cloud Code or admin API.
|
|
359
|
+
// customDataID is the namespace configured in the Unity Dashboard.
|
|
360
|
+
var customData = await CloudSaveService.Instance.Data.Custom.LoadAllAsync("my-game-config");
|
|
361
|
+
|
|
362
|
+
if (customData.TryGetValue("seasonConfig", out var config))
|
|
363
|
+
{
|
|
364
|
+
var season = config.Value.GetAs<SeasonConfig>();
|
|
365
|
+
Debug.Log($"Current season: {season.Name}");
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Query Player Data
|
|
370
|
+
|
|
371
|
+
```csharp
|
|
372
|
+
using Unity.Services.CloudSave.Models;
|
|
373
|
+
using Unity.Services.CloudSave.Models.Data.Player;
|
|
374
|
+
|
|
375
|
+
// Find players with level >= 10, sorted ascending
|
|
376
|
+
var query = new Query(
|
|
377
|
+
fields: new List<FieldFilter>
|
|
378
|
+
{
|
|
379
|
+
new FieldFilter(key: "level", value: 10, op: FieldFilter.OpOptions.GE, asc: true)
|
|
380
|
+
},
|
|
381
|
+
returnKeys: new HashSet<string> { "level", "displayName" },
|
|
382
|
+
offset: 0,
|
|
383
|
+
limit: 20
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
var results = await CloudSaveService.Instance.Data.Player.QueryAsync(query, new QueryOptions());
|
|
387
|
+
|
|
388
|
+
foreach (var entity in results)
|
|
389
|
+
{
|
|
390
|
+
Debug.Log($"Player {entity.Id}:");
|
|
391
|
+
foreach (var item in entity.Data)
|
|
392
|
+
Debug.Log($" {item.Key} = {item.Value.GetAsString()}");
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Save and Load a File
|
|
397
|
+
|
|
398
|
+
```csharp
|
|
399
|
+
// Save
|
|
400
|
+
byte[] screenshotBytes = await CaptureScreenshot();
|
|
401
|
+
await CloudSaveService.Instance.Files.Player.SaveAsync("screenshot_latest", screenshotBytes);
|
|
402
|
+
|
|
403
|
+
// Load
|
|
404
|
+
byte[] loaded = await CloudSaveService.Instance.Files.Player.LoadBytesAsync("screenshot_latest");
|
|
405
|
+
|
|
406
|
+
// Get metadata
|
|
407
|
+
var meta = await CloudSaveService.Instance.Files.Player.GetMetadataAsync("screenshot_latest");
|
|
408
|
+
Debug.Log($"Size: {meta.Size}, ContentType: {meta.ContentType}, Modified: {meta.Modified}");
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### List All Keys
|
|
412
|
+
|
|
413
|
+
```csharp
|
|
414
|
+
var keys = await CloudSaveService.Instance.Data.Player.ListAllKeysAsync();
|
|
415
|
+
foreach (var key in keys)
|
|
416
|
+
{
|
|
417
|
+
Debug.Log($"Key: {key.Key}, WriteLock: {key.WriteLock}, Modified: {key.Modified}");
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Error Handling
|
|
424
|
+
|
|
425
|
+
```csharp
|
|
426
|
+
try { ... }
|
|
427
|
+
catch (CloudSaveConflictException ex)
|
|
428
|
+
{
|
|
429
|
+
// Write-lock conflict -- inspect per-key details
|
|
430
|
+
foreach (var detail in ex.Details)
|
|
431
|
+
Debug.LogError($"Key '{detail.Key}': attempted={detail.AttemptedWriteLock}, existing={detail.ExistingWriteLock}");
|
|
432
|
+
}
|
|
433
|
+
catch (CloudSaveValidationException ex)
|
|
434
|
+
{
|
|
435
|
+
// Input validation failure -- inspect per-field details
|
|
436
|
+
foreach (var detail in ex.Details)
|
|
437
|
+
Debug.LogError($"Field '{detail.Field}' key '{detail.Key}': {string.Join(", ", detail.Messages)}");
|
|
438
|
+
}
|
|
439
|
+
catch (CloudSaveRateLimitedException ex)
|
|
440
|
+
{
|
|
441
|
+
Debug.LogError($"Rate limited. Retry after {ex.RetryAfter}s");
|
|
442
|
+
}
|
|
443
|
+
catch (CloudSaveException ex)
|
|
444
|
+
{
|
|
445
|
+
Debug.LogError($"Cloud Save error: {ex.Message} (reason: {ex.Reason})");
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### `CloudSaveExceptionReason` Enum
|
|
450
|
+
|
|
451
|
+
| Reason | Value | Meaning | Fix |
|
|
452
|
+
|---|---|---| :-- |
|
|
453
|
+
| `Unknown` | 0 | Unknown error | Log `ex.Message`, retry once, then report it |
|
|
454
|
+
| `NoInternetConnection` | 1 | No network | Retry when connectivity returns |
|
|
455
|
+
| `ProjectIdMissing` | 2 | Project ID not set | Link the project in **Project Settings > Services** |
|
|
456
|
+
| `PlayerIdMissing` | 3 | Player not signed in | Sign in before calling Cloud Save |
|
|
457
|
+
| `AccessTokenMissing` | 4 | No access token | Sign in and check the token has not expired |
|
|
458
|
+
| `InvalidArgument` | 5 | Bad input | Correct the keys or values named in the validation details |
|
|
459
|
+
| `Unauthorized` | 6 | Not authorized | Check the access class and any Access Control policy denying the call |
|
|
460
|
+
| `KeyLimitExceeded` | 7 | Too many keys stored | Delete unused keys |
|
|
461
|
+
| `NotFound` | 8 | Key not found | Check the key and the access class used to read it |
|
|
462
|
+
| `TooManyRequests` | 9 | Rate limited | Back off and retry after `RetryAfter` |
|
|
463
|
+
| `ServiceUnavailable` | 10 | Service down | Retry with backoff |
|
|
464
|
+
| `Conflict` | 11 | Write-lock conflict | Reload the keys, merge your change and retry with the new write lock |
|