nccgs 1.0.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/.claude/agents/nccgs-accessibility-specialist.md +26 -0
- package/.claude/agents/nccgs-adversarial-reviewer.md +26 -0
- package/.claude/agents/nccgs-ai-programmer.md +26 -0
- package/.claude/agents/nccgs-analytics-engineer.md +26 -0
- package/.claude/agents/nccgs-art-direction-lead.md +26 -0
- package/.claude/agents/nccgs-audio-direction-lead.md +26 -0
- package/.claude/agents/nccgs-creative-director.md +26 -0
- package/.claude/agents/nccgs-documentation-manager.md +26 -0
- package/.claude/agents/nccgs-economy-designer.md +26 -0
- package/.claude/agents/nccgs-engine-programmer.md +26 -0
- package/.claude/agents/nccgs-game-design-lead.md +26 -0
- package/.claude/agents/nccgs-game-designer.md +26 -0
- package/.claude/agents/nccgs-gameplay-programmer.md +26 -0
- package/.claude/agents/nccgs-level-designer.md +26 -0
- package/.claude/agents/nccgs-live-ops-designer.md +26 -0
- package/.claude/agents/nccgs-localization-lead.md +26 -0
- package/.claude/agents/nccgs-narrative-lead.md +26 -0
- package/.claude/agents/nccgs-network-programmer.md +26 -0
- package/.claude/agents/nccgs-performance-analyst.md +26 -0
- package/.claude/agents/nccgs-producer.md +26 -0
- package/.claude/agents/nccgs-production-coordinator.md +23 -0
- package/.claude/agents/nccgs-programming-lead.md +26 -0
- package/.claude/agents/nccgs-prototyper.md +26 -0
- package/.claude/agents/nccgs-qa-engineer.md +26 -0
- package/.claude/agents/nccgs-qa-lead.md +26 -0
- package/.claude/agents/nccgs-release-engineer.md +26 -0
- package/.claude/agents/nccgs-release-lead.md +26 -0
- package/.claude/agents/nccgs-security-engineer.md +26 -0
- package/.claude/agents/nccgs-sound-designer.md +26 -0
- package/.claude/agents/nccgs-systems-designer.md +26 -0
- package/.claude/agents/nccgs-technical-architect.md +26 -0
- package/.claude/agents/nccgs-technical-artist.md +26 -0
- package/.claude/agents/nccgs-technical-director.md +26 -0
- package/.claude/agents/nccgs-tools-programmer.md +26 -0
- package/.claude/agents/nccgs-ui-programmer.md +26 -0
- package/.claude/agents/nccgs-unity-build-specialist.md +26 -0
- package/.claude/agents/nccgs-unity-content-specialist.md +26 -0
- package/.claude/agents/nccgs-unity-implementer.md +26 -0
- package/.claude/agents/nccgs-unity-rendering-specialist.md +26 -0
- package/.claude/agents/nccgs-unity-systems-specialist.md +26 -0
- package/.claude/agents/nccgs-unity-ui-specialist.md +26 -0
- package/.claude/agents/nccgs-ux-designer.md +26 -0
- package/.claude/agents/nccgs-verification-engineer.md +26 -0
- package/.claude/agents/nccgs-world-builder.md +26 -0
- package/.claude/agents/nccgs-writer.md +26 -0
- package/.claude/nccgs/THIRD_PARTY_NOTICES.md +13 -0
- package/.claude/nccgs/VERSION +1 -0
- package/.claude/nccgs/constitution.md +131 -0
- package/.claude/nccgs/hooks/agent-audit.mjs +10 -0
- package/.claude/nccgs/hooks/common.mjs +41 -0
- package/.claude/nccgs/hooks/post-compact.mjs +1 -0
- package/.claude/nccgs/hooks/pre-compact.mjs +8 -0
- package/.claude/nccgs/hooks/protect-git.mjs +22 -0
- package/.claude/nccgs/hooks/protect-write.mjs +17 -0
- package/.claude/nccgs/hooks/session-start.mjs +15 -0
- package/.claude/nccgs/hooks/session-stop.mjs +7 -0
- package/.claude/nccgs/protocols/agent-contract.md +34 -0
- package/.claude/nccgs/protocols/context-packets.md +13 -0
- package/.claude/nccgs/protocols/evidence.md +15 -0
- package/.claude/nccgs/protocols/model-routing.md +22 -0
- package/.claude/nccgs/protocols/orchestration.md +26 -0
- package/.claude/nccgs/protocols/unity-boundary.md +11 -0
- package/.claude/nccgs/settings.fragment.json +77 -0
- package/.claude/nccgs/studio.json +347 -0
- package/.claude/nccgs/tools/configure-models.mjs +39 -0
- package/.claude/nccgs/unity-skills-manifest.json +727 -0
- package/.claude/nccgs/workflow-catalog.json +317 -0
- package/.claude/rules/nccgs-canonical-docs.md +19 -0
- package/.claude/rules/nccgs-editor-tools.md +12 -0
- package/.claude/rules/nccgs-localization.md +12 -0
- package/.claude/rules/nccgs-networking.md +13 -0
- package/.claude/rules/nccgs-performance.md +14 -0
- package/.claude/rules/nccgs-rendering.md +16 -0
- package/.claude/rules/nccgs-security.md +13 -0
- package/.claude/rules/nccgs-tests.md +18 -0
- package/.claude/rules/nccgs-ui.md +14 -0
- package/.claude/rules/nccgs-unity-assets.md +21 -0
- package/.claude/rules/nccgs-unity-code.md +22 -0
- package/.claude/skills/accessibility-review/SKILL.md +14 -0
- package/.claude/skills/architecture-decision/SKILL.md +14 -0
- package/.claude/skills/asset-audit/SKILL.md +14 -0
- package/.claude/skills/audit/SKILL.md +16 -0
- package/.claude/skills/audit/references/dimensions.md +46 -0
- package/.claude/skills/balance-review/SKILL.md +14 -0
- package/.claude/skills/bug-triage/SKILL.md +14 -0
- package/.claude/skills/build-live-game/SKILL.md +317 -0
- package/.claude/skills/build-live-game/references/achievements.md +779 -0
- package/.claude/skills/build-live-game/references/apis.md +280 -0
- package/.claude/skills/build-live-game/references/authentication.md +437 -0
- package/.claude/skills/build-live-game/references/battlepass.md +860 -0
- package/.claude/skills/build-live-game/references/cloud-code.md +563 -0
- package/.claude/skills/build-live-game/references/cloud-save.md +474 -0
- package/.claude/skills/build-live-game/references/deployment.md +216 -0
- package/.claude/skills/build-live-game/references/player-account.md +813 -0
- package/.claude/skills/build-live-game/references/remote-config.md +96 -0
- package/.claude/skills/build-live-game/references/tooling.md +431 -0
- package/.claude/skills/closure/SKILL.md +14 -0
- package/.claude/skills/code-review/SKILL.md +14 -0
- package/.claude/skills/compatibility-review/SKILL.md +14 -0
- package/.claude/skills/context-pack/SKILL.md +14 -0
- package/.claude/skills/dependency-review/SKILL.md +14 -0
- package/.claude/skills/design/SKILL.md +20 -0
- package/.claude/skills/design-review/SKILL.md +14 -0
- package/.claude/skills/evidence-review/SKILL.md +14 -0
- package/.claude/skills/hotfix/SKILL.md +14 -0
- package/.claude/skills/implement-in-app-purchases/README.md +233 -0
- package/.claude/skills/implement-in-app-purchases/SKILL.md +158 -0
- package/.claude/skills/implement-in-app-purchases/references/api-notes.md +562 -0
- package/.claude/skills/implement-in-app-purchases/references/codeless-catalog.md +331 -0
- package/.claude/skills/implement-in-app-purchases/references/convert-adapty.md +268 -0
- package/.claude/skills/implement-in-app-purchases/references/convert-essentialkit.md +239 -0
- package/.claude/skills/implement-in-app-purchases/references/convert-revenuecat.md +275 -0
- package/.claude/skills/implement-in-app-purchases/references/convert-unipay.md +145 -0
- package/.claude/skills/implement-in-app-purchases/references/migration-v4-to-v5.md +204 -0
- package/.claude/skills/implement-in-app-purchases/references/path-add-iap-to-new-project.md +198 -0
- package/.claude/skills/implement-in-app-purchases/references/path-convert-native-google-billing.md +356 -0
- package/.claude/skills/implement-in-app-purchases/references/path-convert-native-storekit.md +446 -0
- package/.claude/skills/implement-in-app-purchases/references/path-implement-iap-d2c.md +680 -0
- package/.claude/skills/implement-in-app-purchases/references/platform-notes.md +204 -0
- package/.claude/skills/implement-in-app-purchases/references/pre-check.md +205 -0
- package/.claude/skills/incident-recovery/SKILL.md +14 -0
- package/.claude/skills/initialize-ai-navigation/SKILL.md +95 -0
- package/.claude/skills/initialize-ai-navigation/references/navigation-system.md +794 -0
- package/.claude/skills/levelplay-unity-integration/CHANGELOG.md +57 -0
- package/.claude/skills/levelplay-unity-integration/README.md +74 -0
- package/.claude/skills/levelplay-unity-integration/SKILL.md +1126 -0
- package/.claude/skills/levelplay-unity-integration/references/banner-api.md +920 -0
- package/.claude/skills/levelplay-unity-integration/references/best-practices.md +536 -0
- package/.claude/skills/levelplay-unity-integration/references/ilrd-api.md +337 -0
- package/.claude/skills/levelplay-unity-integration/references/initialization-api.md +630 -0
- package/.claude/skills/levelplay-unity-integration/references/interstitial-api.md +899 -0
- package/.claude/skills/levelplay-unity-integration/references/ios-setup.md +491 -0
- package/.claude/skills/levelplay-unity-integration/references/migration-sdk-9.md +666 -0
- package/.claude/skills/levelplay-unity-integration/references/privacy-settings.md +608 -0
- package/.claude/skills/levelplay-unity-integration/references/rewarded-api.md +902 -0
- package/.claude/skills/localization/SKILL.md +135 -0
- package/.claude/skills/localization/references/api-notes.md +76 -0
- package/.claude/skills/localization/resources/L10nBatchProcessor.cs +69 -0
- package/.claude/skills/localization/resources/LocalizedFontAsset.cs +18 -0
- package/.claude/skills/localize-game/SKILL.md +14 -0
- package/.claude/skills/migrate-project/SKILL.md +21 -0
- package/.claude/skills/migrate-project/references/procedure.md +63 -0
- package/.claude/skills/milestone-review/SKILL.md +14 -0
- package/.claude/skills/new-unity-project/SKILL.md +179 -0
- package/.claude/skills/optimize-audio/SKILL.md +199 -0
- package/.claude/skills/optimize-audio/resources/audio-import-api.md +146 -0
- package/.claude/skills/optimize-audio/resources/platform-settings.md +48 -0
- package/.claude/skills/optimize-text-mesh-pro/SKILL.md +182 -0
- package/.claude/skills/optimize-web/SKILL.md +393 -0
- package/.claude/skills/optimize-web/resources/WebOptimizer.cs +21 -0
- package/.claude/skills/optimize-web/resources/toktx-examples.sh +11 -0
- package/.claude/skills/performance-audit/SKILL.md +14 -0
- package/.claude/skills/physics-3d-collision/SKILL.md +442 -0
- package/.claude/skills/physics-3d-collision/references/troubleshooting.md +41 -0
- package/.claude/skills/physics-3d-collision/resources/CollisionDebugger.cs +33 -0
- package/.claude/skills/plan-feature/SKILL.md +14 -0
- package/.claude/skills/playtest/SKILL.md +14 -0
- package/.claude/skills/project-stage/SKILL.md +14 -0
- package/.claude/skills/prototype-feature/SKILL.md +14 -0
- package/.claude/skills/qa-plan/SKILL.md +14 -0
- package/.claude/skills/release/SKILL.md +18 -0
- package/.claude/skills/release-readiness/SKILL.md +14 -0
- package/.claude/skills/retrospective/SKILL.md +14 -0
- package/.claude/skills/review/SKILL.md +16 -0
- package/.claude/skills/security-audit/SKILL.md +14 -0
- package/.claude/skills/setup-multiplayer-services/SKILL.md +39 -0
- package/.claude/skills/setup-multiplayer-services/references/dgs-entrypoint.md +79 -0
- package/.claude/skills/setup-multiplayer-services/references/entrypoints.md +213 -0
- package/.claude/skills/setup-multiplayer-services/references/examples.md +33 -0
- package/.claude/skills/setup-multiplayer-services/references/implementation-fit.md +30 -0
- package/.claude/skills/setup-multiplayer-services/references/underlying-services.md +11 -0
- package/.claude/skills/setup-multiplayer-services/references/workflows-prerequisites.md +17 -0
- package/.claude/skills/setup-vivox-voice-chat/SKILL.md +118 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/.env.example +6 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/README.md +101 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/promptfooconfig.yaml +32 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/tests/init-and-login.yaml +76 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/tests/text-chat.yaml +65 -0
- package/.claude/skills/setup-vivox-voice-chat/evals/tests/voice-channels.yaml +74 -0
- package/.claude/skills/setup-vivox-voice-chat/references/events-and-participants.md +79 -0
- package/.claude/skills/setup-vivox-voice-chat/references/init-and-login.md +92 -0
- package/.claude/skills/setup-vivox-voice-chat/references/text-chat.md +93 -0
- package/.claude/skills/setup-vivox-voice-chat/references/troubleshooting.md +47 -0
- package/.claude/skills/setup-vivox-voice-chat/references/voice-channels.md +90 -0
- package/.claude/skills/shader-graph-create-custom-node/SKILL.md +25 -0
- package/.claude/skills/shader-graph-create-custom-node/resources/all_hints.hlsl +182 -0
- package/.claude/skills/sprint-plan/SKILL.md +14 -0
- package/.claude/skills/sprite-editor/SKILL.md +66 -0
- package/.claude/skills/sprite-editor/references/api_reference.md +151 -0
- package/.claude/skills/sprite-editor/references/background.md +112 -0
- package/.claude/skills/sprite-editor/references/templates.md +72 -0
- package/.claude/skills/sprite-editor/scripts/AutomaticSliceTexture.cs +40 -0
- package/.claude/skills/sprite-editor/scripts/GenerateNewSpriteRects.cs +200 -0
- package/.claude/skills/sprite-editor/scripts/GetTextureSourceImageSize.cs +32 -0
- package/.claude/skills/sprite-editor/scripts/GetTextureToSlice.cs +55 -0
- package/.claude/skills/sprite-editor/scripts/GridSliceTexture.cs +40 -0
- package/.claude/skills/sprite-editor/scripts/IsometricSliceTexture.cs +141 -0
- package/.claude/skills/sprite-editor/scripts/README.md +134 -0
- package/.claude/skills/sprite-editor/scripts/SetPivotExample.cs +58 -0
- package/.claude/skills/sprite-editor/scripts/SpriteToPng.cs +88 -0
- package/.claude/skills/status/SKILL.md +16 -0
- package/.claude/skills/story-readiness/SKILL.md +14 -0
- package/.claude/skills/test/SKILL.md +16 -0
- package/.claude/skills/ui/SKILL.md +142 -0
- package/.claude/skills/ui-imgui/SKILL.md +186 -0
- package/.claude/skills/ui-imgui/references/gui-elements.md +156 -0
- package/.claude/skills/ui-imgui/references/templates.md +141 -0
- package/.claude/skills/ui-review/SKILL.md +14 -0
- package/.claude/skills/ui-ugui/SKILL.md +282 -0
- package/.claude/skills/ui-ugui/references/scrollview-setup.md +29 -0
- package/.claude/skills/ui-uitk/SKILL.md +235 -0
- package/.claude/skills/ui-uitk/references/common-issues.md +74 -0
- package/.claude/skills/ui-uitk/references/custom-elements.md +241 -0
- package/.claude/skills/ui-uitk/references/painter2d.md +282 -0
- package/.claude/skills/ui-uitk/references/pointermanipulator-guide.md +94 -0
- package/.claude/skills/ui-uitk/references/svg-icons.md +136 -0
- package/.claude/skills/ui-uitk/references/ui-runtime-binding.md +234 -0
- package/.claude/skills/ui-uitk/references/uss-guide.md +138 -0
- package/.claude/skills/unity-cli/CHANGELOG.md +233 -0
- package/.claude/skills/unity-cli/SECURITY.md +22 -0
- package/.claude/skills/unity-cli/SKILL.md +414 -0
- package/.claude/skills/unity-cli/references/auth-license-cloud.md +146 -0
- package/.claude/skills/unity-cli/references/build-run-test.md +349 -0
- package/.claude/skills/unity-cli/references/collaboration.md +472 -0
- package/.claude/skills/unity-cli/references/config-hub.md +103 -0
- package/.claude/skills/unity-cli/references/diagnostics-maintenance.md +326 -0
- package/.claude/skills/unity-cli/references/editors-install.md +327 -0
- package/.claude/skills/unity-cli/references/integration-advanced.md +472 -0
- package/.claude/skills/unity-cli/references/projects-templates.md +574 -0
- package/.claude/skills/unity-package-management/SKILL.md +304 -0
- package/.claude/skills/unity-package-management/references/select-packages.md +108 -0
- package/.claude/skills/urp-postprocessing/SKILL.md +188 -0
- package/.claude/skills/urp-postprocessing/references/code-templates.md +119 -0
- package/.claude/skills/urp-postprocessing/references/effect-reference.md +86 -0
- package/.claude/skills/validate-urp-render-graph-renderer-feature/SKILL.md +269 -0
- package/.claude/skills/work/SKILL.md +36 -0
- package/.claude/skills/work/references/classification.md +41 -0
- package/.claude/skills/work/references/closure.md +50 -0
- package/.claude/skills/work/references/feature-contracts.md +32 -0
- package/.claude/skills/work/references/verification.md +26 -0
- package/CLAUDE.md +6 -0
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/THIRD_PARTY_NOTICES.md +23 -0
- package/UPGRADING.md +32 -0
- package/VERSION +1 -0
- package/docs/ARCHITECTURE.md +73 -0
- package/docs/HUONG-DAN-MIGRATE-VA-SU-DUNG.md +324 -0
- package/docs/MIGRATION-MATRIX.md +23 -0
- package/docs/PROJECT-POLICY.md +67 -0
- package/docs/WORKFLOWS.md +61 -0
- package/package-assets/setup-vivox-voice-chat-evals.gitignore +7 -0
- package/package.json +41 -0
- package/scaffold/.nccgs/bugs/.gitkeep +1 -0
- package/scaffold/.nccgs/closures/.gitkeep +1 -0
- package/scaffold/.nccgs/context/.gitkeep +1 -0
- package/scaffold/.nccgs/decisions/.gitkeep +1 -0
- package/scaffold/.nccgs/evidence/.gitkeep +1 -0
- package/scaffold/.nccgs/features/.gitkeep +1 -0
- package/scaffold/.nccgs/migrations/.gitkeep +1 -0
- package/scaffold/.nccgs/playtests/.gitkeep +1 -0
- package/scaffold/.nccgs/project.yaml +103 -0
- package/scaffold/.nccgs/requirements.yaml +10 -0
- package/scaffold/.nccgs/reviews/.gitkeep +1 -0
- package/scaffold/.nccgs/state.md +40 -0
- package/scaffold/.nccgs/templates/agent-handoff.md +25 -0
- package/scaffold/.nccgs/templates/architecture-decision.md +27 -0
- package/scaffold/.nccgs/templates/closure-record.md +51 -0
- package/scaffold/.nccgs/templates/context-packet.yaml +17 -0
- package/scaffold/.nccgs/templates/evidence-record.md +23 -0
- package/scaffold/.nccgs/templates/feature-contract.md +35 -0
- package/scaffold/.nccgs/templates/migration-plan.md +40 -0
- package/scaffold/.nccgs/templates/waiver.md +11 -0
- package/scripts/cli.mjs +56 -0
- package/scripts/install.mjs +267 -0
- package/scripts/sync-unity-skills.mjs +126 -0
- package/scripts/validate.mjs +205 -0
- package/tests/framework.test.mjs +121 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Unity IAP Platform-Specific Notes
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Apple App Store Extensions](#apple-app-store-extensions)
|
|
6
|
+
- [Google Play Store Extensions](#google-play-store-extensions)
|
|
7
|
+
- [Apple JWS Representation (Server-Side Validation)](#apple-jws-representation-server-side-validation)
|
|
8
|
+
- [SubscriptionInfo Platform Nuances](#subscriptioninfo-platform-nuances)
|
|
9
|
+
- [Cross-Platform Best Practices](#cross-platform-best-practices)
|
|
10
|
+
- [Platform Extension Availability](#platform-extension-availability)
|
|
11
|
+
|
|
12
|
+
## Apple App Store Extensions
|
|
13
|
+
|
|
14
|
+
Access via `store.AppleStoreExtendedPurchaseService` (for purchase features) and `store.AppleStoreExtendedService` (for store features).
|
|
15
|
+
|
|
16
|
+
### Promotional Purchases
|
|
17
|
+
|
|
18
|
+
Apple can present purchases from the App Store product page. Intercept and handle them:
|
|
19
|
+
|
|
20
|
+
```csharp
|
|
21
|
+
if (store.AppleStoreExtendedPurchaseService != null)
|
|
22
|
+
{
|
|
23
|
+
store.AppleStoreExtendedPurchaseService.OnPromotionalPurchaseIntercepted += (product) =>
|
|
24
|
+
{
|
|
25
|
+
// Player tapped "Buy" on App Store product page
|
|
26
|
+
// You can delay the purchase (e.g., show a loading screen first)
|
|
27
|
+
Debug.Log($"Promotional purchase intercepted: {product.definition.id}");
|
|
28
|
+
|
|
29
|
+
// When ready, continue the purchase
|
|
30
|
+
store.AppleStoreExtendedPurchaseService.ContinuePromotionalPurchases();
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**CRITICAL:** If you subscribe to `OnPromotionalPurchaseIntercepted`, you MUST eventually call `ContinuePromotionalPurchases()` or the purchase will hang indefinitely.
|
|
36
|
+
|
|
37
|
+
### Ask-to-Buy (Parental Approval)
|
|
38
|
+
|
|
39
|
+
On devices with Family Sharing and a child account, purchases may require parental approval:
|
|
40
|
+
|
|
41
|
+
```csharp
|
|
42
|
+
store.OnPurchaseDeferred += (deferredOrder) =>
|
|
43
|
+
{
|
|
44
|
+
// Purchase is waiting for parental approval
|
|
45
|
+
// Show UI: "Purchase pending approval"
|
|
46
|
+
// Do NOT grant content yet
|
|
47
|
+
Debug.Log("Purchase deferred - awaiting approval");
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The purchase will complete later (triggering `OnPurchasePending`) when approved, or fail when rejected.
|
|
52
|
+
|
|
53
|
+
For testing in sandbox:
|
|
54
|
+
|
|
55
|
+
```csharp
|
|
56
|
+
// Simulate Ask-to-Buy in the editor/sandbox
|
|
57
|
+
store.AppleStoreExtendedPurchaseService.simulateAskToBuy = true;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Offer Code Redemption
|
|
61
|
+
|
|
62
|
+
Present the Apple offer code redemption sheet:
|
|
63
|
+
|
|
64
|
+
```csharp
|
|
65
|
+
store.AppleStoreExtendedPurchaseService.PresentCodeRedemptionSheet();
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Entitlement Revocation
|
|
69
|
+
|
|
70
|
+
Listen for revoked entitlements (e.g., refund granted):
|
|
71
|
+
|
|
72
|
+
```csharp
|
|
73
|
+
store.AppleStoreExtendedPurchaseService.OnEntitlementRevoked += (productId) =>
|
|
74
|
+
{
|
|
75
|
+
Debug.Log($"Entitlement revoked for: {productId}");
|
|
76
|
+
// Remove the content/feature from the player
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Store Capabilities
|
|
81
|
+
|
|
82
|
+
```csharp
|
|
83
|
+
// Check if the device can make payments (parental controls may block)
|
|
84
|
+
bool canPay = store.AppleStoreExtendedService.canMakePayments;
|
|
85
|
+
|
|
86
|
+
// Set App Account Token for server-to-server verification
|
|
87
|
+
store.AppleStoreExtendedService.SetAppAccountToken(Guid.NewGuid());
|
|
88
|
+
|
|
89
|
+
// Fetch storefront info (StoreKit 2 only)
|
|
90
|
+
store.AppleStoreExtendedService.FetchStorefront(
|
|
91
|
+
(storefront) => Debug.Log($"Storefront: {storefront.CountryCode}"),
|
|
92
|
+
(error) => Debug.LogError($"Storefront error: {error}")
|
|
93
|
+
);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Google Play Store Extensions
|
|
97
|
+
|
|
98
|
+
Access via `store.GooglePlayStoreExtendedPurchaseService` (for purchase features) and `store.GooglePlayStoreExtendedService` (for store features).
|
|
99
|
+
|
|
100
|
+
### Subscription Upgrade/Downgrade
|
|
101
|
+
|
|
102
|
+
Change a player's subscription tier:
|
|
103
|
+
|
|
104
|
+
```csharp
|
|
105
|
+
// Get the current subscription order and the new product
|
|
106
|
+
Order currentOrder = /* the player's current subscription order */;
|
|
107
|
+
Product newProduct = store.GetProductById("com.mygame.vip_annual");
|
|
108
|
+
|
|
109
|
+
store.GooglePlayStoreExtendedPurchaseService.UpgradeDowngradeSubscription(
|
|
110
|
+
currentOrder,
|
|
111
|
+
newProduct,
|
|
112
|
+
GooglePlayReplacementMode.ChargeFullPrice
|
|
113
|
+
);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### GooglePlayReplacementMode Values
|
|
117
|
+
|
|
118
|
+
| Mode | Behavior |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `UnknownReplacementMode` | Default |
|
|
121
|
+
| `WithTimeProration` | Remaining time is adjusted |
|
|
122
|
+
| `ChargeProratedPrice` | Prorated charge for the upgrade |
|
|
123
|
+
| `WithoutProration` | New plan starts at next billing |
|
|
124
|
+
| `ChargeFullPrice` | Full price charged immediately |
|
|
125
|
+
| `Deferred` | Change takes effect at next billing |
|
|
126
|
+
|
|
127
|
+
### Obfuscated IDs
|
|
128
|
+
|
|
129
|
+
Set obfuscated account/profile IDs for fraud detection:
|
|
130
|
+
|
|
131
|
+
```csharp
|
|
132
|
+
store.GooglePlayStoreExtendedService.SetObfuscatedAccountId("hashed_account_id");
|
|
133
|
+
store.GooglePlayStoreExtendedService.SetObfuscatedProfileId("hashed_profile_id");
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Retrieve them from an order:
|
|
137
|
+
|
|
138
|
+
```csharp
|
|
139
|
+
string accountId = store.GooglePlayStoreExtendedPurchaseService.GetObfuscatedAccountId(order);
|
|
140
|
+
string profileId = store.GooglePlayStoreExtendedPurchaseService.GetObfuscatedProfileId(order);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Deferred Payment Events
|
|
144
|
+
|
|
145
|
+
```csharp
|
|
146
|
+
store.GooglePlayStoreExtendedPurchaseService.OnDeferredPaymentUntilRenewalDate += (deferredOrder) =>
|
|
147
|
+
{
|
|
148
|
+
Debug.Log($"Payment deferred until renewal: {deferredOrder.SubscriptionOrdered.definition.id}");
|
|
149
|
+
};
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Apple JWS Representation (Server-Side Validation)
|
|
153
|
+
|
|
154
|
+
For server-side Apple receipt validation (replacing the deprecated `CrossPlatformValidator`):
|
|
155
|
+
|
|
156
|
+
```csharp
|
|
157
|
+
store.OnPurchasePending += (pendingOrder) =>
|
|
158
|
+
{
|
|
159
|
+
// Access the JWS-signed transaction
|
|
160
|
+
string jws = pendingOrder.Info.Apple?.jwsRepresentation;
|
|
161
|
+
// Send to your server for validation with Apple's App Store Server API (v2)
|
|
162
|
+
ValidateOnServer(jws);
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `jwsRepresentation` contains a signed JSON Web Signature that can be verified using Apple's public keys.
|
|
167
|
+
|
|
168
|
+
## SubscriptionInfo Platform Nuances
|
|
169
|
+
|
|
170
|
+
| Method | Apple | Google |
|
|
171
|
+
|---|---|---|
|
|
172
|
+
| `GetPurchaseDate()` | Returns the **renewal date** (most recent renewal) | Returns the **original purchase date** |
|
|
173
|
+
| `GetCancelDate()` | Returns actual cancellation date | Returns `DateTime.MinValue` (not supported) |
|
|
174
|
+
|
|
175
|
+
Always check `IsSubscribed()` first — if the result is `Result.Unsupported`, the platform doesn't provide that information.
|
|
176
|
+
|
|
177
|
+
## Cross-Platform Best Practices
|
|
178
|
+
|
|
179
|
+
| Concern | Recommendation |
|
|
180
|
+
|---|---|
|
|
181
|
+
| Restore button | Required on iOS (Apple guideline). Add a "Restore Purchases" button that calls `store.RestoreTransactions()`. |
|
|
182
|
+
| Receipt validation | **Google Play:** Use `CrossPlatformValidator(GooglePlayTangle.Data(), Application.identifier)` for local validation. **Apple (StoreKit 2):** Local validation via `CrossPlatformValidator` is a **no-op** — use `order.Info.Apple?.jwsRepresentation` for server-side validation instead. |
|
|
183
|
+
| Pending purchases | Always handle `OnPurchasePending` and call `ConfirmPurchase`. Unconfirmed purchases persist across launches. |
|
|
184
|
+
| Product IDs | Use reverse-domain naming: `com.company.game.product` |
|
|
185
|
+
| Testing | Use sandbox accounts (Apple) and license testing accounts (Google) for testing without real charges. |
|
|
186
|
+
| Subscriptions | Always check `IsSubscribed()` at app launch, not just purchase time. Subscriptions can expire or be cancelled externally. |
|
|
187
|
+
|
|
188
|
+
## Platform Extension Availability
|
|
189
|
+
|
|
190
|
+
| Extension | iOS | Android | Editor |
|
|
191
|
+
|---|---|---|---|
|
|
192
|
+
| `AppleStoreExtendedService` | Available | `null` | `null` |
|
|
193
|
+
| `AppleStoreExtendedPurchaseService` | Available | `null` | `null` |
|
|
194
|
+
| `GooglePlayStoreExtendedService` | `null` | Available | `null` |
|
|
195
|
+
| `GooglePlayStoreExtendedPurchaseService` | `null` | Available | `null` |
|
|
196
|
+
|
|
197
|
+
**CRITICAL:** Always null-check platform extensions before use:
|
|
198
|
+
|
|
199
|
+
```csharp
|
|
200
|
+
if (store.AppleStoreExtendedPurchaseService != null)
|
|
201
|
+
{
|
|
202
|
+
store.AppleStoreExtendedPurchaseService.OnPromotionalPurchaseIntercepted += HandlePromo;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Pre-Check: Project Scan and Path Routing
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Ambiguous Intent](#ambiguous-intent)
|
|
6
|
+
- [IAP D2C Capabilities (Direct-to-Customer, Third-Party Payment Provider)](#iap-d2c-capabilities-direct-to-customer-third-party-payment-provider)
|
|
7
|
+
- [Scan Order (standard IAP paths)](#scan-order-standard-iap-paths)
|
|
8
|
+
- [Routing Summary](#routing-summary)
|
|
9
|
+
|
|
10
|
+
Scan steps: [1 — Third-Party IAP Package Check](#1--third-party-iap-package-check-highest-priority) · [2 — Native Google Billing](#2--native-google-billing-check) · [2b — Native iOS StoreKit](#2b--native-ios-storekit-check) · [3 — Unity IAP v4](#3--unity-iap-v4-check) · [4 — Unity IAP v5 Already Installed](#4--unity-iap-v5-already-installed) · [5 — No IAP Detected](#5--no-iap-detected)
|
|
11
|
+
Third-party sub-checks: [1a Essential Kit](#1a--essential-kit-conversion-supported) · [1b UniPay](#1b--unipay-assessment-path) · [1c RevenueCat](#1c--revenuecat-assessment-path) · [1d Adapty](#1d--adapty-assessment-path)
|
|
12
|
+
|
|
13
|
+
Run this scan before doing anything else. Do not read any other reference file or make any changes until routing is resolved.
|
|
14
|
+
|
|
15
|
+
## Ambiguous Intent
|
|
16
|
+
|
|
17
|
+
If the user's prompt does not clearly indicate which billing backend they want — for example:
|
|
18
|
+
|
|
19
|
+
- "Add a StoreController for me"
|
|
20
|
+
- "Add a purchase manager"
|
|
21
|
+
- "Set up IAP"
|
|
22
|
+
- "Help me add in-app purchases"
|
|
23
|
+
- "Upgrade to latest IAP"
|
|
24
|
+
|
|
25
|
+
**Stop and ask before scanning or routing:**
|
|
26
|
+
|
|
27
|
+
> "Would you like to implement purchasing using:
|
|
28
|
+
> - **Apple App Store / Google Play** (standard platform billing), or
|
|
29
|
+
> - **IAP D2C Capabilities** (third-party payment provider such as Stripe or Coda via Unity Cloud)?"
|
|
30
|
+
|
|
31
|
+
Do not assume a default. Route only after the user confirms their intent.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## IAP D2C Capabilities (Direct-to-Customer, Third-Party Payment Provider)
|
|
36
|
+
|
|
37
|
+
If the user explicitly asks for IAP D2C Capabilities, Stripe/Coda payment integration, or a third-party payment provider, **do not follow the standard scan order below**. Instead:
|
|
38
|
+
|
|
39
|
+
- If the project has IAP v4, native Google Billing, or a third-party IAP package → resolve those blockers first using the standard scan order, then return here.
|
|
40
|
+
- If the project has no IAP, or has `com.unity.purchasing` **v5.4+** → route to [path-implement-iap-d2c.md](path-implement-iap-d2c.md).
|
|
41
|
+
- If the project has `com.unity.purchasing` **v5.0–5.3** → inform the user that IAP D2C Capabilities require v5.4+, instruct them to upgrade via Package Manager, and continue once the upgrade is confirmed.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Scan Order (standard IAP paths)
|
|
46
|
+
|
|
47
|
+
Run scans in this exact order. The first match wins — stop scanning and route immediately.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 1 — Third-Party IAP Package Check (highest priority)
|
|
52
|
+
|
|
53
|
+
#### 1a — Essential Kit (conversion supported)
|
|
54
|
+
|
|
55
|
+
Search `Packages/manifest.json` and `Packages/packages-lock.json` for `com.voxelbusters.essentialkit`.
|
|
56
|
+
|
|
57
|
+
**If found → only one path is valid:**
|
|
58
|
+
|
|
59
|
+
> Route to [convert-essentialkit.md](convert-essentialkit.md)
|
|
60
|
+
|
|
61
|
+
Inform the user that Essential Kit was detected and that the conversion path will be used. Do not offer any other path.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
#### 1b — UniPay (assessment path)
|
|
66
|
+
|
|
67
|
+
Search `Packages/manifest.json`, `Packages/packages-lock.json`, and `Assets/Plugins/` for UniPay signals:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
com\.flobuk\.unipay|UniPay|Assets/Plugins/UniPay|Assets/Plugins/SIS
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**If found → only one path is valid:**
|
|
74
|
+
|
|
75
|
+
> Route to [convert-unipay.md](convert-unipay.md)
|
|
76
|
+
|
|
77
|
+
Inform the user that UniPay was detected and that the assessment path will be used. Do not offer any other path.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
#### 1c — RevenueCat (assessment path)
|
|
82
|
+
|
|
83
|
+
Search `Packages/manifest.json` and `Packages/packages-lock.json` for `com.revenuecat.purchases-unity`.
|
|
84
|
+
|
|
85
|
+
**If found → only one path is valid:**
|
|
86
|
+
|
|
87
|
+
> Route to [convert-revenuecat.md](convert-revenuecat.md)
|
|
88
|
+
|
|
89
|
+
Inform the user that RevenueCat was detected and that the assessment path will be used. Do not offer any other path.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
#### 1d — Adapty (assessment path)
|
|
94
|
+
|
|
95
|
+
Search `Packages/manifest.json`, `Packages/packages-lock.json`, and `Assets/` for Adapty signals:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
com\.adapty|Assets/Adapty|AdaptySDK
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**If found → only one path is valid:**
|
|
102
|
+
|
|
103
|
+
> Route to [convert-adapty.md](convert-adapty.md)
|
|
104
|
+
|
|
105
|
+
Inform the user that Adapty was detected and that the assessment path will be used. Do not offer any other path.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### 2 — Native Google Billing Check
|
|
110
|
+
|
|
111
|
+
Search the following locations:
|
|
112
|
+
|
|
113
|
+
- `Assets/**/*.cs` for: `AndroidJavaObject|AndroidJavaClass|BillingClient|BillingManager|GoogleBilling|BillingBridge`
|
|
114
|
+
- `Assets/Plugins/Android/**/*.java`, `*.kt` for: `com\.android\.billingclient`
|
|
115
|
+
- `mainTemplate.gradle`, `launcherTemplate.gradle`, `baseProjectTemplate.gradle` for: `com\.android\.billingclient:billing`
|
|
116
|
+
|
|
117
|
+
**If found → only one path is valid:**
|
|
118
|
+
|
|
119
|
+
> Route to [path-convert-native-google-billing.md](path-convert-native-google-billing.md)
|
|
120
|
+
|
|
121
|
+
Inform the user that native Google Billing was detected and that the conversion path will be used. If `com.unity.purchasing` is absent or not the latest stable version, instruct the user to install or upgrade to the latest stable version via Package Manager before proceeding.
|
|
122
|
+
|
|
123
|
+
Do not offer any other path.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 2b — Native iOS StoreKit Check
|
|
128
|
+
|
|
129
|
+
Search the following for native StoreKit signals:
|
|
130
|
+
|
|
131
|
+
- `Assets/Plugins/iOS/**/*.m`, `*.mm`, `*.h`, `*.swift` for: `SKProductsRequest|SKPaymentQueue|SKPaymentTransaction|SKPaymentTransactionObserver|Product\.products|Transaction\.currentEntitlements`
|
|
132
|
+
- `Assets/**/*.cs` for: `DllImport.*__Internal` combined with IAP-related method names, or `UnitySendMessage` calls associated with StoreKit
|
|
133
|
+
|
|
134
|
+
**If found → only one path is valid:**
|
|
135
|
+
|
|
136
|
+
> Route to [path-convert-native-storekit.md](path-convert-native-storekit.md)
|
|
137
|
+
|
|
138
|
+
Inform the user that a native iOS StoreKit plugin was detected and that the conversion path will be used. If `com.unity.purchasing` is absent or not the latest stable version, instruct the user to install or upgrade via Package Manager before proceeding.
|
|
139
|
+
|
|
140
|
+
Do not offer any other path.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### 3 — Unity IAP v4 Check
|
|
145
|
+
|
|
146
|
+
Search `Packages/manifest.json` for `com.unity.purchasing` with a version matching `4\.`.
|
|
147
|
+
|
|
148
|
+
Also search `Assets/**/*.cs` for legacy v4 API patterns:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
IStoreListener|UnityPurchasing\.Initialize|ConfigurationBuilder
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**If found → only one path is valid:**
|
|
155
|
+
|
|
156
|
+
> Route to [migration-v4-to-v5.md](migration-v4-to-v5.md)
|
|
157
|
+
|
|
158
|
+
Inform the user that Unity IAP v4 was detected and that the v4→v5 migration path will be used. Do not offer any other path.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### 4 — Unity IAP v5 Already Installed
|
|
163
|
+
|
|
164
|
+
If none of the above matched, search `Packages/manifest.json` for `com.unity.purchasing` with a version matching `5\.`:
|
|
165
|
+
|
|
166
|
+
**If found → inform the user:**
|
|
167
|
+
|
|
168
|
+
> "This project already has Unity IAP v5 installed. You can extend the existing setup — for example, add new products, add platform-specific features, or integrate IAP D2C Capabilities. What would you like to do?"
|
|
169
|
+
|
|
170
|
+
Then route based on the user's answer. Do not automatically route to the new-project path — the project already has IAP configured.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### 5 — No IAP Detected
|
|
175
|
+
|
|
176
|
+
If none of the above matched and `com.unity.purchasing` is absent from `manifest.json`:
|
|
177
|
+
|
|
178
|
+
**→ only one path is valid:**
|
|
179
|
+
|
|
180
|
+
> Route to [path-add-iap-to-new-project.md](path-add-iap-to-new-project.md)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Routing Summary
|
|
185
|
+
|
|
186
|
+
| What is detected | Valid path |
|
|
187
|
+
|---|---|
|
|
188
|
+
| Essential Kit (`com.voxelbusters.essentialkit`) | Convert Essential Kit billing → IAP 5 — see convert-essentialkit.md |
|
|
189
|
+
| UniPay (FLOBUK) | Assessment — see convert-unipay.md |
|
|
190
|
+
| RevenueCat | Assessment — see convert-revenuecat.md |
|
|
191
|
+
| Adapty | Assessment — see convert-adapty.md |
|
|
192
|
+
| Native Google BillingClient | Convert native Google Billing → IAP 5 — see path-convert-native-google-billing.md |
|
|
193
|
+
| Native iOS StoreKit plugin (`SKPaymentQueue` / `DllImport("__Internal")`) | Convert native StoreKit → IAP 5 — see path-convert-native-storekit.md |
|
|
194
|
+
| `com.unity.purchasing` v4 or v4 API patterns | Migrate IAP v4 → v5 |
|
|
195
|
+
| `com.unity.purchasing` v5 already installed | Ask user what to extend — do not auto-route |
|
|
196
|
+
| No IAP detected | Add Unity IAP 5 to new project |
|
|
197
|
+
| User explicitly requests IAP D2C Capabilities / payment provider | See IAP D2C Capabilities section above |
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Also check: Codeless catalog presence
|
|
202
|
+
|
|
203
|
+
Regardless of which route above wins, check whether `Assets/Resources/IAPProductCatalog.json` exists. This is the **Codeless IAP** catalog and is independent of the routing decision — but if it is present and `enableCodelessAutoInitialization` is true, adding a scripted `StoreController` creates a race condition with `CodelessIAPStoreListener`.
|
|
204
|
+
|
|
205
|
+
Surface the catalog's presence and auto-init flag to the user before generating scripted IAP code. See [codeless-catalog.md](codeless-catalog.md) for the race condition details and the three mitigation options.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incident-recovery
|
|
3
|
+
description: Coordinates evidence-preserving response to data loss, corruption, broken builds, failed migrations, or production-impacting Unity incidents.
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Incident Recovery
|
|
8
|
+
|
|
9
|
+
Read `.nccgs/project.yaml`, `.nccgs/state.md`, and the active context packet when present. Preserve Product Owner authority and unrelated work.
|
|
10
|
+
|
|
11
|
+
Prioritize containment and evidence preservation. Record incident scope, affected versions/data, current state, timeline, hypotheses, and irreversible-action boundaries. Avoid destructive cleanup and speculative rewrites. Build a recovery graph with backups, reproducible diagnostics, validation, and rollback. Apply only authorized recovery changes; maintain an incident record and follow-up prevention actions. Data deletion or production actions require explicit authority.
|
|
12
|
+
|
|
13
|
+
Return outcome, evidence, affected records, blockers or decisions, residual risk, and the exact next workflow. Do not claim DONE unless this is the `closure` skill and every configured gate passes.
|
|
14
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: initialize-ai-navigation
|
|
3
|
+
description: Sets up and configures the Unity AI Navigation system — NavMesh surfaces, NavMesh agents, obstacles, links, modifiers, areas and costs. Use when creating walkable navigation meshes, adding pathfinding agents, setting up patrol routes, configuring obstacle avoidance and carving, connecting separate NavMeshes with links, coupling navigation with animation, or troubleshooting navigation issues.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Determine what the user needs and guide them through navigation setup. See [navigation-system.md](references/navigation-system.md) for expanded component details, API notes, code recipes, and troubleshooting.
|
|
7
|
+
|
|
8
|
+
### Passing C# to `eval`
|
|
9
|
+
|
|
10
|
+
`eval` compiles a **statement block, not a file**. Two consequences, both of which cause a
|
|
11
|
+
compile error rather than a warning:
|
|
12
|
+
|
|
13
|
+
- **No `using` directives.** The compiler reads `using UnityEngine;` as a resource-disposal
|
|
14
|
+
statement and rejects it (`CS0210`).
|
|
15
|
+
- **Types must be fully qualified.** A bare `AssetDatabase` or `Volume` does not resolve
|
|
16
|
+
(`CS0246` / `CS0103`), and a bare `Object` is ambiguous with `object` (`CS0104`).
|
|
17
|
+
|
|
18
|
+
Where a snippet below is written as a file — with usings, for readability, or because it is
|
|
19
|
+
meant to be saved into the project — qualify the types before passing it to `eval`.
|
|
20
|
+
|
|
21
|
+
## Routing Logic
|
|
22
|
+
|
|
23
|
+
| User Says | Interpretation |
|
|
24
|
+
|-----------|---------------|
|
|
25
|
+
| "add navigation" / "set up nav" | Full setup: NavMeshSurface + bake + NavMeshAgent |
|
|
26
|
+
| "make this character navigate" | Add NavMeshAgent, ensure NavMesh exists |
|
|
27
|
+
| "add pathfinding" | NavMeshAgent + movement script |
|
|
28
|
+
| "agent won't move" / "path not found" | Troubleshoot — see Troubleshooting Decision Tree in reference |
|
|
29
|
+
| "avoid obstacles" | NavMeshObstacle with carving or avoidance |
|
|
30
|
+
| "connect two areas" / "jump across" | NavMeshLink between areas |
|
|
31
|
+
| "patrol between points" | NavMeshAgent + patrol script |
|
|
32
|
+
| "click to move" | NavMeshAgent + raycast click-to-move script |
|
|
33
|
+
| "animate the character while navigating" | Couple Animator with NavMeshAgent |
|
|
34
|
+
| "different agent sizes" | Configure agent types in Navigation window |
|
|
35
|
+
| "areas and costs" / "restrict areas" | NavMesh area types, modifiers, and agent area masks |
|
|
36
|
+
|
|
37
|
+
## Workflow
|
|
38
|
+
|
|
39
|
+
### 0. Package Installation Check
|
|
40
|
+
Before doing anything else, verify that `com.unity.ai.navigation` is installed. If it's missing,
|
|
41
|
+
add it to `Packages/manifest.json` under `dependencies` — Unity resolves it when the Editor next
|
|
42
|
+
regains focus, and this needs no Editor connection:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
"com.unity.ai.navigation": "<current 2.x version>"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Don't invent the version string. Read the current one from the Unity registry —
|
|
49
|
+
`https://packages.unity.com/com.unity.ai.navigation` lists every published version — or copy the version an
|
|
50
|
+
adjacent Unity package in this manifest already uses. A version that doesn't exist makes
|
|
51
|
+
Unity fail resolution **silently**, so a wrong guess looks like nothing happened.
|
|
52
|
+
|
|
53
|
+
Proceed only once it's confirmed installed. If you have a live Editor to run C# in, see
|
|
54
|
+
[navigation-system.md](references/navigation-system.md) for the `Client.Add` equivalent.
|
|
55
|
+
|
|
56
|
+
### 1. Pre-Flight: Assess Current Navigation Setup
|
|
57
|
+
Before making changes, inspect what already exists:
|
|
58
|
+
1. Find the existing navigation components. With a connected Editor, query the live scene for
|
|
59
|
+
`NavMeshSurface`, `NavMeshAgent`, `NavMeshObstacle`, `NavMeshLink` and `NavMeshModifier` — see
|
|
60
|
+
the `unity-cli` skill for driving a running Editor. Without one, search the scene and prefab
|
|
61
|
+
files for those component names.
|
|
62
|
+
2. Check configured agent types via **Window > AI > Navigation > Agents tab**.
|
|
63
|
+
3. Summarize ALL detected navigation components before proposing changes.
|
|
64
|
+
|
|
65
|
+
### 2. Gather Missing Information
|
|
66
|
+
Before creating components, ensure the user has specified: walkable surfaces, agent type/size, agent behavior, obstacles, links, and area/cost requirements. Ask if anything is unclear. See the Information Gathering Checklist in the reference for full details.
|
|
67
|
+
|
|
68
|
+
### 3. Planning & Execution
|
|
69
|
+
Follow this general order. See the Component Setup Guide in the reference for detailed step-by-step instructions per component:
|
|
70
|
+
1. **NavMesh Surface** — create the walkable mesh (bake it)
|
|
71
|
+
2. **NavMesh Agent** — add pathfinding characters
|
|
72
|
+
3. **NavMesh Obstacle** — add dynamic obstacles
|
|
73
|
+
4. **NavMesh Link** — connect disconnected NavMesh areas
|
|
74
|
+
5. **NavMesh Modifier / Modifier Volume** — fine-tune area types
|
|
75
|
+
6. **Scripts** — movement, patrol, click-to-move, animation coupling (see Common Recipes in reference)
|
|
76
|
+
|
|
77
|
+
### 4. Validation
|
|
78
|
+
After setup, confirm:
|
|
79
|
+
- NavMesh is baked and visible (blue overlay)
|
|
80
|
+
- NavMeshSurface agent type matches NavMeshAgent agent type
|
|
81
|
+
- Agents have a valid path to their destination
|
|
82
|
+
- Obstacles carve or obstruct correctly
|
|
83
|
+
- Links have both ends connected and Activated is enabled
|
|
84
|
+
- Area masks allow the intended movement
|
|
85
|
+
- No conflicting components (see Mixing Components Guide in reference)
|
|
86
|
+
- If using Rigidbody with NavMeshAgent, Is Kinematic is enabled
|
|
87
|
+
|
|
88
|
+
### 5. Final Confirmation
|
|
89
|
+
Summarize what was created or changed:
|
|
90
|
+
- NavMesh Surfaces: which GameObject, agent type, geometry mode, bake status
|
|
91
|
+
- NavMesh Agent(s): which GameObject, speed, stopping distance, area mask
|
|
92
|
+
- NavMesh Obstacle(s): which GameObject, shape, carve on/off
|
|
93
|
+
- NavMesh Link(s): start/end, bidirectional, area type
|
|
94
|
+
- Scripts: which scripts attached to which GameObjects
|
|
95
|
+
- Any manual steps required (adjust waypoints, re-bake after scene changes, etc.)
|