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,90 @@
|
|
|
1
|
+
# Voice Channels
|
|
2
|
+
|
|
3
|
+
## Channel Types
|
|
4
|
+
|
|
5
|
+
| Type | Join method | Use for |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| Non-positional (group) | `JoinGroupChannelAsync` | Party, team, lobby, guild — all participants hear each other equally |
|
|
8
|
+
| Echo | `JoinEchoChannelAsync` | Test-only — your own audio is echoed back |
|
|
9
|
+
| Positional (3D) | `JoinPositionalChannelAsync` | Proximity / spatial audio driven by transform position |
|
|
10
|
+
|
|
11
|
+
## Join Signatures
|
|
12
|
+
|
|
13
|
+
```csharp
|
|
14
|
+
Task JoinGroupChannelAsync(
|
|
15
|
+
string channelName,
|
|
16
|
+
ChatCapability chatCapability,
|
|
17
|
+
ChannelOptions channelOptions = null);
|
|
18
|
+
|
|
19
|
+
Task JoinEchoChannelAsync(
|
|
20
|
+
string channelName,
|
|
21
|
+
ChatCapability chatCapability,
|
|
22
|
+
ChannelOptions channelOptions = null);
|
|
23
|
+
|
|
24
|
+
Task JoinPositionalChannelAsync(
|
|
25
|
+
string channelName,
|
|
26
|
+
ChatCapability chatCapability,
|
|
27
|
+
Channel3DProperties positionalChannelProperties,
|
|
28
|
+
ChannelOptions channelOptions = null);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The returned `Task` completes when the *request* has been sent, not when the join is complete. The actual join fires `ChannelJoined(string channelName)`. Bind that event **before** calling the join method.
|
|
32
|
+
|
|
33
|
+
## ChatCapability
|
|
34
|
+
|
|
35
|
+
- `ChatCapability.TextOnly` — text-only channel (no audio at all)
|
|
36
|
+
- `ChatCapability.AudioOnly` — voice-only, no text
|
|
37
|
+
- `ChatCapability.TextAndAudio` — both
|
|
38
|
+
|
|
39
|
+
## ChannelOptions
|
|
40
|
+
|
|
41
|
+
Optional. Common use: set this channel as the active transmit target on join success. Leave `null` for default behavior (join without changing transmission mode).
|
|
42
|
+
|
|
43
|
+
## Positional Channels — Channel3DProperties
|
|
44
|
+
|
|
45
|
+
`Channel3DProperties` controls how distance and direction affect voice attenuation. Key fields:
|
|
46
|
+
|
|
47
|
+
- `AudibleDistance` — beyond this, participant is inaudible.
|
|
48
|
+
- `ConversationalDistance` — below this, participant is at full volume.
|
|
49
|
+
- `AudioFadeIntensityByDistance` — falloff steepness between conversational and audible distance.
|
|
50
|
+
- `AudioFadeModel` — `InverseByDistance`, `LinearByDistance`, `ExponentialByDistance`.
|
|
51
|
+
|
|
52
|
+
Example call-site:
|
|
53
|
+
|
|
54
|
+
```csharp
|
|
55
|
+
var props = new Channel3DProperties(
|
|
56
|
+
audibleDistance: 50,
|
|
57
|
+
conversationalDistance: 5,
|
|
58
|
+
audioFadeIntensityByDistance: 1.0f,
|
|
59
|
+
audioFadeModel: AudioFadeModel.InverseByDistance);
|
|
60
|
+
|
|
61
|
+
await VivoxService.Instance.JoinPositionalChannelAsync(
|
|
62
|
+
"world-proximity", ChatCapability.AudioOnly, props);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Drive per-frame position updates by calling `VivoxService.Instance.Set3DPosition(GameObject speakerObject, string channelName)` from a listener/speaker script (typically on the player camera and on remote player representations).
|
|
66
|
+
|
|
67
|
+
For >200 participants in a positional channel, enable the enterprise-tier Large 3D channels setting; see the documentation map's positional channels page.
|
|
68
|
+
|
|
69
|
+
## Leaving
|
|
70
|
+
|
|
71
|
+
```csharp
|
|
72
|
+
await VivoxService.Instance.LeaveChannelAsync(channelName);
|
|
73
|
+
await VivoxService.Instance.LeaveAllChannelsAsync();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Both fire `ChannelLeft(string channelName)` for each channel exited.
|
|
77
|
+
|
|
78
|
+
## Mic Permission
|
|
79
|
+
|
|
80
|
+
Joining an `AudioOnly` or `TextAndAudio` channel requires microphone access.
|
|
81
|
+
|
|
82
|
+
- **Android:** request `RECORD_AUDIO` at runtime with `Permission.RequestUserPermission(Permission.Microphone)` before the first audio-capable join. Merge `<uses-permission android:name="android.permission.RECORD_AUDIO"/>` if not present.
|
|
83
|
+
- **iOS:** add `NSMicrophoneUsageDescription` to the Info.plist (Project Settings → Player → iOS → Microphone Usage Description).
|
|
84
|
+
- **Desktop / WebGL:** the browser or OS prompts on first capture attempt; no code change required, but WebGL has additional limitations — see [troubleshooting.md](troubleshooting.md).
|
|
85
|
+
|
|
86
|
+
## Muting
|
|
87
|
+
|
|
88
|
+
- **Local mic mute (self):** `VivoxService.Instance.MuteInputDevice()` / `UnmuteInputDevice()` — parameterless pair that stops your audio from being sent anywhere. Read state via the `IsInputDeviceMuted` property.
|
|
89
|
+
- **Mute another player locally (only you stop hearing them):** `participant.MutePlayerLocally()` / `participant.UnmutePlayerLocally()` on the `VivoxParticipant` from `ParticipantAddedToChannel`.
|
|
90
|
+
- **Server-side kick / mute-all:** requires a privileged Vivox Access Token minted server-side.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shader-graph-create-custom-node
|
|
3
|
+
description: "Generates custom Shader Graph nodes from HLSL code. Use when the user wants to create a new Shader Graph node or make existing HLSL code work as a reflected function node."
|
|
4
|
+
required_packages:
|
|
5
|
+
com.unity.shadergraph: ">=17.5.0"
|
|
6
|
+
---
|
|
7
|
+
# Generating a custom Shader Graph node
|
|
8
|
+
|
|
9
|
+
## Step 1: Generate an HLSL function definition
|
|
10
|
+
- The function must be preceded by the preprocessor define `UNITY_EXPORT_REFLECTION`
|
|
11
|
+
|
|
12
|
+
## Step 2: Decorate with Shader Graph hint tags
|
|
13
|
+
- See `resources/all_hints.hlsl` for all valid hint tags and usage patterns
|
|
14
|
+
- C#-style documentation tags are supported outside of `funchints` or `paramhints` blocks
|
|
15
|
+
- Required function hints:
|
|
16
|
+
- `sg:ProviderKey`
|
|
17
|
+
- `sg:SearchCategory`
|
|
18
|
+
- `sg:SearchTerms`
|
|
19
|
+
- `sg:DisplayName`
|
|
20
|
+
|
|
21
|
+
## Step 3: Write the code to an asset
|
|
22
|
+
- Search the project for a `ShaderInclude` asset (`.hlsl`) that already contains custom Shader Graph nodes
|
|
23
|
+
- If a matching asset exists, show the user its current contents and ask for confirmation before appending the new code
|
|
24
|
+
- If no matching asset exists, create a new `.hlsl` asset
|
|
25
|
+
- Ensure the file begins with `#include "ShaderApiReflectionSupport.hlsl"`
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#include "ShaderApiReflectionSupport.hlsl"
|
|
2
|
+
|
|
3
|
+
namespace Namespace
|
|
4
|
+
{
|
|
5
|
+
struct CustomStruct
|
|
6
|
+
{
|
|
7
|
+
float Value;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/// <funchints>
|
|
11
|
+
/// <sg:ProviderKey>AllHintsUniqueStableID</sg:ProviderKey>
|
|
12
|
+
/// <sg:DisplayName>All Known Hints</sg:DisplayName>
|
|
13
|
+
/// <sg:ReturnDisplayName>Final Result</sg:ReturnDisplayName>
|
|
14
|
+
/// <sg:SearchCategory>Hints/All</sg:SearchCategory>
|
|
15
|
+
/// <sg:SearchTerms>Features, Reflected, Every, Hint</sg:SearchTerms>
|
|
16
|
+
/// <sg:SearchName>All Hints Search Name</sg:SearchName>
|
|
17
|
+
/// </funchints>
|
|
18
|
+
/// <paramhints name="a">
|
|
19
|
+
/// <sg:DisplayName>Custom Struct Value</sg:DisplayName>
|
|
20
|
+
/// <sg:Default>0.5</sg:Default>
|
|
21
|
+
/// <sg:External>Namespace</sg:External>
|
|
22
|
+
/// </paramhints>
|
|
23
|
+
/// <paramhints name="c3">
|
|
24
|
+
/// <sg:DisplayName>Color 3</sg:DisplayName>
|
|
25
|
+
/// <sg:Color />
|
|
26
|
+
/// <sg:Default>1,1,0</sg:Default>
|
|
27
|
+
/// </paramhints>
|
|
28
|
+
/// <paramhints name="c4">
|
|
29
|
+
/// <sg:DisplayName>Color 4</sg:DisplayName>
|
|
30
|
+
/// <sg:Color />
|
|
31
|
+
/// <sg:Default>1,1,0,1</sg:Default>
|
|
32
|
+
/// </paramhints>
|
|
33
|
+
/// <paramhints name="sc3">
|
|
34
|
+
/// <sg:DisplayName>Static Color 3</sg:DisplayName>
|
|
35
|
+
/// <sg:Color />
|
|
36
|
+
/// <sg:Static />
|
|
37
|
+
/// <sg:Default>1,1,0</sg:Default>
|
|
38
|
+
/// </paramhints>
|
|
39
|
+
/// <paramhints name="sc4">
|
|
40
|
+
/// <sg:DisplayName>Static Color 4</sg:DisplayName>
|
|
41
|
+
/// <sg:Color />
|
|
42
|
+
/// <sg:Static />
|
|
43
|
+
/// <sg:Default>1,1,0,1</sg:Default>
|
|
44
|
+
/// </paramhints>
|
|
45
|
+
/// <paramhints name="d">
|
|
46
|
+
/// <sg:DisplayName>Dropdown</sg:DisplayName>
|
|
47
|
+
/// <sg:Dropdown>OptionA, OptionB, OptionC</sg:Dropdown>
|
|
48
|
+
/// <sg:Default>1</sg:Default>
|
|
49
|
+
/// </paramhints>
|
|
50
|
+
/// <paramhints name="sd">
|
|
51
|
+
/// <sg:DisplayName>Dropdown</sg:DisplayName>
|
|
52
|
+
/// <sg:Dropdown>OptionA, OptionB, OptionC</sg:Dropdown>
|
|
53
|
+
/// <sg:Static />
|
|
54
|
+
/// <sg:Default>2</sg:Default>
|
|
55
|
+
/// </paramhints>
|
|
56
|
+
/// <paramhints name="r">
|
|
57
|
+
/// <sg:DisplayName>Range</sg:DisplayName>
|
|
58
|
+
/// <sg:Range>0, 1</sg:Range>
|
|
59
|
+
/// <sg:Default>0.75</sg:Default>
|
|
60
|
+
/// </paramhints>
|
|
61
|
+
/// <paramhints name="sr">
|
|
62
|
+
/// <sg:DisplayName>Range</sg:DisplayName>
|
|
63
|
+
/// <sg:Static />
|
|
64
|
+
/// <sg:Range>0, 1</sg:Range>
|
|
65
|
+
/// <sg:Default>0.25</sg:Default>
|
|
66
|
+
/// </paramhints>
|
|
67
|
+
/// <paramhints name="sb">
|
|
68
|
+
/// <sg:DisplayName>Toggle</sg:DisplayName>
|
|
69
|
+
/// <sg:Static />
|
|
70
|
+
/// <sg:Default>1</sg:Default>
|
|
71
|
+
/// </paramhints>
|
|
72
|
+
/// <paramhints name="si">
|
|
73
|
+
/// <sg:DisplayName>Integer</sg:DisplayName>
|
|
74
|
+
/// <sg:Static />
|
|
75
|
+
/// <sg:Default>5</sg:Default>
|
|
76
|
+
/// </paramhints>
|
|
77
|
+
UNITY_EXPORT_REFLECTION float3 AllHints(
|
|
78
|
+
inout CustomStruct a,
|
|
79
|
+
float3 c3,
|
|
80
|
+
inout float4 c4,
|
|
81
|
+
float3 sc3,
|
|
82
|
+
float4 sc4,
|
|
83
|
+
inout uint d,
|
|
84
|
+
uint sd,
|
|
85
|
+
float r,
|
|
86
|
+
float sr,
|
|
87
|
+
bool sb,
|
|
88
|
+
int si
|
|
89
|
+
)
|
|
90
|
+
{
|
|
91
|
+
return float3(a.Value, sr, sc4.r);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
} // Namespace
|
|
95
|
+
|
|
96
|
+
/// <funchints>
|
|
97
|
+
/// <sg:ProviderKey>GoodReferables</sg:ProviderKey>
|
|
98
|
+
/// </funchints>
|
|
99
|
+
/// <paramhints name="UV">
|
|
100
|
+
/// <UV/>
|
|
101
|
+
/// <Default>UV2</Default>
|
|
102
|
+
/// </paramhints>
|
|
103
|
+
/// <paramhints name="alsoUV">
|
|
104
|
+
/// <sg:Referable>UV</sg:Referable>
|
|
105
|
+
/// <Default>UV1</Default>
|
|
106
|
+
/// </paramhints>
|
|
107
|
+
/// <paramhints name="Position">
|
|
108
|
+
/// <Position/>
|
|
109
|
+
/// <Default>AbsoluteWorld</Default>
|
|
110
|
+
/// </paramhints>
|
|
111
|
+
/// <paramhints name="Normal">
|
|
112
|
+
/// <Normal/>
|
|
113
|
+
/// <Default>World</Default>
|
|
114
|
+
/// </paramhints>
|
|
115
|
+
/// <paramhints name="Tangent">
|
|
116
|
+
/// <Tangent/>
|
|
117
|
+
/// <Default>Object</Default>
|
|
118
|
+
/// </paramhints>
|
|
119
|
+
/// <paramhints name="Bitangent">
|
|
120
|
+
/// <Bitangent/>
|
|
121
|
+
/// <Default>Tangent</Default>
|
|
122
|
+
/// </paramhints>
|
|
123
|
+
/// <paramhints name="ViewDirection">
|
|
124
|
+
/// <ViewDirection/>
|
|
125
|
+
/// <Default>Screen</Default>
|
|
126
|
+
/// </paramhints>
|
|
127
|
+
/// <paramhints name="VertColor">
|
|
128
|
+
/// <VertexColor/>
|
|
129
|
+
/// </paramhints>
|
|
130
|
+
/// <paramhints name="ScreenPosition">
|
|
131
|
+
/// <ScreenPosition/>
|
|
132
|
+
/// <Default>Pixel</Default>
|
|
133
|
+
/// </paramhints>
|
|
134
|
+
/// <paramhints name="defaultValue">
|
|
135
|
+
/// <Default>1,0,0</Default>
|
|
136
|
+
/// </paramhints>
|
|
137
|
+
UNITY_EXPORT_REFLECTION float3 ReferableGood(float2 UV,
|
|
138
|
+
float2 alsoUV,
|
|
139
|
+
float3 Position,
|
|
140
|
+
float3 Normal,
|
|
141
|
+
float3 Tangent,
|
|
142
|
+
float3 Bitangent,
|
|
143
|
+
float3 ViewDirection,
|
|
144
|
+
float4 VertColor,
|
|
145
|
+
float4 ScreenPosition,
|
|
146
|
+
float3 defaultValue)
|
|
147
|
+
{
|
|
148
|
+
return float3(1,1,0);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// <funchints>
|
|
152
|
+
/// <sg:ProviderKey>PrecisionTest</sg:ProviderKey>
|
|
153
|
+
/// <Precision/>
|
|
154
|
+
/// </funchints>
|
|
155
|
+
/// <paramhints name="a">
|
|
156
|
+
/// <Dynamic/>
|
|
157
|
+
/// </paramhints>
|
|
158
|
+
/// <paramhints name="b">
|
|
159
|
+
/// <Dynamic/>
|
|
160
|
+
/// </paramhints>
|
|
161
|
+
/// <paramhints name="c">
|
|
162
|
+
/// <Dynamic/>
|
|
163
|
+
/// </paramhints>
|
|
164
|
+
UNITY_EXPORT_REFLECTION float2 PrecisionTest(float a, half b, out float c)
|
|
165
|
+
{
|
|
166
|
+
c = a + b;
|
|
167
|
+
return (a,b);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/// <funchints>
|
|
171
|
+
/// <sg:ProviderKey>LinkageExample</sg:ProviderKey>
|
|
172
|
+
/// </funchints>
|
|
173
|
+
/// <paramhints name="test">
|
|
174
|
+
/// <Linkage>other</Linkage>
|
|
175
|
+
/// </paramhints>
|
|
176
|
+
UNITY_EXPORT_REFLECTION float3 LinkageExample(bool test, float other)
|
|
177
|
+
{
|
|
178
|
+
if (test)
|
|
179
|
+
return float3(other, 0, 0);
|
|
180
|
+
else
|
|
181
|
+
return float3(0, other, 0);
|
|
182
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sprint-plan
|
|
3
|
+
description: Creates a capacity-aware, dependency-ordered short-horizon plan from approved features, risks, Product Owner priority, and verification/closure work.
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Write, Edit, Task, AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sprint Plan
|
|
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
|
+
Read mapped planning sources, priorities, feature readiness, dependencies, known defects, capacity assumptions, and release constraints. Do not invent dates or capacity. Select a coherent goal, order work by dependency and risk, include verification/closure, identify ownership and PO decisions, and expose stretch work separately. Persist in the canonical planning location and keep scope changes explicit.
|
|
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,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sprite-editor
|
|
3
|
+
description: Edits Unity sprite properties by generating C# editor scripts using ISpriteEditorDataProvider APIs. Handles sprite rectangles, borders, pivots, outlines, and slicing operations (automatic, grid, isometric). Use when working with sprite assets, sprite sheets, texture atlases, or sprite slicing.
|
|
4
|
+
modes: [agent, ask]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sprite Editor
|
|
8
|
+
|
|
9
|
+
Sprite metadata (rects, borders, pivots, outlines) lives inside the importer, not in a file
|
|
10
|
+
you can edit — reaching it means running C# through a live Editor.
|
|
11
|
+
|
|
12
|
+
**The `unity-cli` skill owns getting you there** — installing the CLI, confirming a connected
|
|
13
|
+
Editor, adding the project's `com.unity.pipeline` package, telling a genuinely absent Editor
|
|
14
|
+
apart from one stuck in Safe Mode, and discovering the Editor's command catalog. Follow it
|
|
15
|
+
first; don't re-derive any of it here.
|
|
16
|
+
|
|
17
|
+
Two things it can't know for you:
|
|
18
|
+
|
|
19
|
+
- **You need `eval` in particular**, not just a reachable Editor. Confirm it appears in the
|
|
20
|
+
catalog — its presence depends on the Pipeline package version, not on the CLI.
|
|
21
|
+
- **Never hand-edit a `.meta` file to change sprite metadata.** The importer owns that data
|
|
22
|
+
and the capability checks below exist to prevent corruption, so an unreachable Editor is a
|
|
23
|
+
stop, not a cue to improvise.
|
|
24
|
+
|
|
25
|
+
Run C# through the connected Editor with the `eval` command. Discover its parameter shape
|
|
26
|
+
from `unity command --format json` rather than assuming one — the inline form is
|
|
27
|
+
`unity command eval --code '<snippet>'`, and some Pipeline versions also register
|
|
28
|
+
`eval_file` for running a snippet from a file. **Check the catalog before reaching for
|
|
29
|
+
`eval_file`; it is frequently absent.** `unity command` defaults to a 30 second timeout.
|
|
30
|
+
|
|
31
|
+
Generates C# editor scripts to manipulate Unity sprites using ISpriteEditorDataProvider. Works with TextureImporter, PSBImporter, and custom importers.
|
|
32
|
+
|
|
33
|
+
### Passing C# to `eval`
|
|
34
|
+
|
|
35
|
+
`eval` compiles a **statement block, not a file**. Two consequences, both of which cause a
|
|
36
|
+
compile error rather than a warning:
|
|
37
|
+
|
|
38
|
+
- **No `using` directives.** The compiler reads `using UnityEngine;` as a resource-disposal
|
|
39
|
+
statement and rejects it (`CS0210`).
|
|
40
|
+
- **Types must be fully qualified.** A bare `AssetDatabase` or `Volume` does not resolve
|
|
41
|
+
(`CS0246` / `CS0103`), and a bare `Object` is ambiguous with `object` (`CS0104`).
|
|
42
|
+
|
|
43
|
+
Where a snippet below is written as a file — with usings, for readability, or because it is
|
|
44
|
+
meant to be saved into the project — qualify the types before passing it to `eval`.
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
All generated scripts must follow the Safe Core Pattern in [references/templates.md](references/templates.md), which includes MANDATORY capability checks. NEVER attempt operations if capability checks fail - this prevents data corruption. After execution, verify results in Unity console and Project window.
|
|
49
|
+
|
|
50
|
+
## Common Operations
|
|
51
|
+
|
|
52
|
+
**Modify Name/Rect/Border/Pivot:** Update corresponding `SpriteRect` fields (see scripts/SetPivotExample.cs for pivot examples)
|
|
53
|
+
- Requires: `EditSpriteName`, `EditSpriteRect`, `EditBorder`, or `EditPivot`
|
|
54
|
+
|
|
55
|
+
**Add/Remove/Slice:** Create or filter `SpriteRect` array (see [references/background.md](references/background.md) for Unity 2021.2+ requirements)
|
|
56
|
+
- Requires: `CreateAndDeleteSprite`
|
|
57
|
+
|
|
58
|
+
**Set Outlines:** Get `ISpriteOutlineDataProvider` → Call `SetOutlines()` with GUID + Vector2 arrays
|
|
59
|
+
|
|
60
|
+
## Important Notes
|
|
61
|
+
|
|
62
|
+
- Do NOT use AssetPostprocessor or MenuItem patterns
|
|
63
|
+
- Generate standalone snippets only — no `AssetPostprocessor`, no `MenuItem`
|
|
64
|
+
- **Enum assignments:** Always use enum values and cast to numeric types. Never use raw numbers.
|
|
65
|
+
- ✅ Correct: `(int)SpriteAlignment.Center`
|
|
66
|
+
- ❌ Wrong: `1` (magic number)
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Unity Sprite Editor API Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Core Interface: ISpriteEditorDataProvider](#core-interface-ispriteeditordataprovider)
|
|
5
|
+
- [Properties](#properties)
|
|
6
|
+
- [Core Methods](#core-methods)
|
|
7
|
+
- [Callbacks](#callbacks)
|
|
8
|
+
- [Additional Data Providers](#additional-data-providers)
|
|
9
|
+
- [ISpriteNameFileIdDataProvider](#ispritenamefileiddataprovider)
|
|
10
|
+
- [ISpriteOutlineDataProvider](#ispriteoutlinedataprovider)
|
|
11
|
+
- [ISpritePhysicsOutlineDataProvider](#ispritephysicsoutlinedataprovider)
|
|
12
|
+
- [ISpriteBoneDataProvider](#ispritebonedataprovider)
|
|
13
|
+
- [ISpriteMeshDataProvider](#ispritemeshdataprovider)
|
|
14
|
+
- [ITextureDataProvider](#itexturedataprovider)
|
|
15
|
+
- [ISecondaryTextureDataProvider](#isecondarytexturedataprovider)
|
|
16
|
+
- [ISpriteFrameEditCapability](#ispriteframeeditcapability)
|
|
17
|
+
- [SpriteRect Properties](#spriterect-properties)
|
|
18
|
+
- [Common Patterns](#common-patterns)
|
|
19
|
+
- [Modifying Sprite Properties](#modifying-sprite-properties)
|
|
20
|
+
- [Working with Selection](#working-with-selection)
|
|
21
|
+
- [Version Considerations](#version-considerations)
|
|
22
|
+
|
|
23
|
+
## Core Interface: ISpriteEditorDataProvider
|
|
24
|
+
|
|
25
|
+
Main interface for editing sprite data. See [templates.md](templates.md) for the standard initialization and usage pattern.
|
|
26
|
+
|
|
27
|
+
### Properties
|
|
28
|
+
- `SpriteImportMode spriteImportMode` - How sprite data will be imported
|
|
29
|
+
- `float pixelsPerUnit` - Pixels per unit in world space
|
|
30
|
+
- `UnityObject targetObject` - Object providing the data
|
|
31
|
+
|
|
32
|
+
### Core Methods
|
|
33
|
+
- `SpriteRect[] GetSpriteRects()` - Returns array of SpriteRect
|
|
34
|
+
- `void SetSpriteRects(SpriteRect[] spriteRects)` - Updates sprite rectangles
|
|
35
|
+
- `void Apply()` - Applies changed data
|
|
36
|
+
- `void InitSpriteEditorDataProvider()` - Initializes the provider
|
|
37
|
+
- `T GetDataProvider<T>()` - Gets additional data providers
|
|
38
|
+
- `bool HasDataProvider(Type type)` - Checks if provider type is supported
|
|
39
|
+
|
|
40
|
+
### Callbacks
|
|
41
|
+
- `void RegisterDataChangeCallback(Action<ISpriteEditorDataProvider> action)`
|
|
42
|
+
- `void UnregisterDataChangeCallback(Action<ISpriteEditorDataProvider> action)`
|
|
43
|
+
|
|
44
|
+
## Additional Data Providers
|
|
45
|
+
|
|
46
|
+
### ISpriteNameFileIdDataProvider
|
|
47
|
+
Maps sprite names to file IDs (required for Unity 2021.2+ when adding/removing sprites).
|
|
48
|
+
|
|
49
|
+
```csharp
|
|
50
|
+
var nameFileIdProvider = dataProvider.GetDataProvider<ISpriteNameFileIdDataProvider>();
|
|
51
|
+
IEnumerable<SpriteNameFileIdPair> pairs = nameFileIdProvider.GetNameFileIdPairs();
|
|
52
|
+
nameFileIdProvider.SetNameFileIdPairs(updatedPairs);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### ISpriteOutlineDataProvider
|
|
56
|
+
Manages outline data for sprite tessellation.
|
|
57
|
+
|
|
58
|
+
```csharp
|
|
59
|
+
var outlineProvider = dataProvider.GetDataProvider<ISpriteOutlineDataProvider>();
|
|
60
|
+
List<Vector2[]> outlines = outlineProvider.GetOutlines(spriteGuid);
|
|
61
|
+
outlineProvider.SetOutlines(spriteGuid, newOutlines);
|
|
62
|
+
float tessellation = outlineProvider.GetTessellationDetail(spriteGuid);
|
|
63
|
+
outlineProvider.SetTessellationDetail(spriteGuid, 0.5f); // 0-1 range
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### ISpritePhysicsOutlineDataProvider
|
|
67
|
+
Manages physics outlines for Polygon Collider 2D.
|
|
68
|
+
|
|
69
|
+
```csharp
|
|
70
|
+
var physicsProvider = dataProvider.GetDataProvider<ISpritePhysicsOutlineDataProvider>();
|
|
71
|
+
List<Vector2[]> physicsOutlines = physicsProvider.GetOutlines(spriteGuid);
|
|
72
|
+
physicsProvider.SetOutlines(spriteGuid, newPhysicsOutlines);
|
|
73
|
+
float tessellation = physicsProvider.GetTessellationDetail(spriteGuid);
|
|
74
|
+
physicsProvider.SetTessellationDetail(spriteGuid, 0.5f);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### ISpriteBoneDataProvider
|
|
78
|
+
Manages bone data for 2D animation.
|
|
79
|
+
|
|
80
|
+
```csharp
|
|
81
|
+
var boneProvider = dataProvider.GetDataProvider<ISpriteBoneDataProvider>();
|
|
82
|
+
List<SpriteBone> bones = boneProvider.GetBones(spriteGuid);
|
|
83
|
+
boneProvider.SetBones(spriteGuid, updatedBones);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### ISpriteMeshDataProvider
|
|
87
|
+
Manages custom sprite mesh data (vertices, indices, edges).
|
|
88
|
+
|
|
89
|
+
```csharp
|
|
90
|
+
var meshProvider = dataProvider.GetDataProvider<ISpriteMeshDataProvider>();
|
|
91
|
+
Vertex2DMetaData[] vertices = meshProvider.GetVertices(spriteGuid);
|
|
92
|
+
int[] indices = meshProvider.GetIndices(spriteGuid);
|
|
93
|
+
Vector2Int[] edges = meshProvider.GetEdges(spriteGuid);
|
|
94
|
+
|
|
95
|
+
meshProvider.SetVertices(spriteGuid, newVertices);
|
|
96
|
+
meshProvider.SetIndices(spriteGuid, newIndices);
|
|
97
|
+
meshProvider.SetEdges(spriteGuid, newEdges);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### ITextureDataProvider
|
|
101
|
+
Provides texture data for Sprite Editor.
|
|
102
|
+
|
|
103
|
+
```csharp
|
|
104
|
+
var textureProvider = dataProvider.GetDataProvider<ITextureDataProvider>();
|
|
105
|
+
Texture2D texture = textureProvider.texture;
|
|
106
|
+
Texture2D preview = textureProvider.previewTexture;
|
|
107
|
+
textureProvider.GetTextureActualWidthAndHeight(out int width, out int height);
|
|
108
|
+
Texture2D readable = textureProvider.GetReadableTexture2D();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### ISecondaryTextureDataProvider
|
|
112
|
+
Manages secondary textures.
|
|
113
|
+
|
|
114
|
+
```csharp
|
|
115
|
+
var secondaryProvider = dataProvider.GetDataProvider<ISecondaryTextureDataProvider>();
|
|
116
|
+
SecondarySpriteTexture[] textures = secondaryProvider.textures;
|
|
117
|
+
secondaryProvider.textures = newTextures;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### ISpriteFrameEditCapability
|
|
121
|
+
Controls sprite frame editing capabilities.
|
|
122
|
+
|
|
123
|
+
```csharp
|
|
124
|
+
var capabilityProvider = dataProvider.GetDataProvider<ISpriteFrameEditCapability>();
|
|
125
|
+
EditCapability capability = capabilityProvider.GetEditCapability();
|
|
126
|
+
capabilityProvider.SetEditCapability(newCapability);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## SpriteRect Properties
|
|
130
|
+
|
|
131
|
+
Key properties that can be modified on `SpriteRect`:
|
|
132
|
+
|
|
133
|
+
- `string name` - Sprite name
|
|
134
|
+
- `GUID spriteID` - Unique identifier (matches sprite asset's `GetSpriteID()`)
|
|
135
|
+
- `Rect rect` - Position and size in texture
|
|
136
|
+
- `Vector2 pivot` - Pivot point (0-1 range, relative to rect)
|
|
137
|
+
- `SpriteAlignment alignment` - Alignment preset (BottomLeft, Center, Custom, etc.)
|
|
138
|
+
- `Vector4 border` - 9-slice border (left, bottom, right, top)
|
|
139
|
+
|
|
140
|
+
**Note**: The `spriteID` property matches the GUID returned by calling `GetSpriteID()` on a sprite asset at runtime. This allows matching between editor-time configuration and runtime sprites.
|
|
141
|
+
|
|
142
|
+
## Common Patterns
|
|
143
|
+
|
|
144
|
+
See [templates.md](templates.md) for code patterns including:
|
|
145
|
+
- Safe Core Pattern with capability checks
|
|
146
|
+
- Modifying sprite properties
|
|
147
|
+
- Working with selection
|
|
148
|
+
|
|
149
|
+
## Version Considerations
|
|
150
|
+
|
|
151
|
+
See [background.md](background.md#version-specific-requirements) for Unity version-specific requirements (ISpriteNameFileIdDataProvider in 2021.2+).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Sprite Editor Background Information
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Why Use ISpriteEditorDataProvider](#why-use-ispriteeditordataprovider)
|
|
5
|
+
- [Original vs Imported Image Sizes](#original-vs-imported-image-sizes)
|
|
6
|
+
- [The Critical Distinction](#the-critical-distinction)
|
|
7
|
+
- [Important Implications](#important-implications)
|
|
8
|
+
- [Critical for Slicing Operations](#critical-for-slicing-operations)
|
|
9
|
+
- [Importer Compatibility](#importer-compatibility)
|
|
10
|
+
- [TextureImporter Configuration](#textureimporter-configuration)
|
|
11
|
+
- [Other Importers](#other-importers)
|
|
12
|
+
- [Data Provider Initialization](#data-provider-initialization)
|
|
13
|
+
- [Version-Specific Requirements](#version-specific-requirements)
|
|
14
|
+
- [Unity 2021.2+](#unity-20212)
|
|
15
|
+
- [Unity 2021.1 and Earlier](#unity-20211-and-earlier)
|
|
16
|
+
|
|
17
|
+
## Why Use ISpriteEditorDataProvider
|
|
18
|
+
|
|
19
|
+
**ISpriteEditorDataProvider provides a unified interface** that works across all importer types (TextureImporter, PSBImporter, custom importers). This ensures:
|
|
20
|
+
- Scripts work consistently regardless of importer type
|
|
21
|
+
- Changes are properly communicated to the importer
|
|
22
|
+
- Sprite metadata is handled correctly
|
|
23
|
+
|
|
24
|
+
**Never access importer-specific properties directly.** Always use ISpriteEditorDataProvider for compatibility.
|
|
25
|
+
|
|
26
|
+
## Original vs Imported Image Sizes
|
|
27
|
+
|
|
28
|
+
### The Critical Distinction
|
|
29
|
+
|
|
30
|
+
**Sprite data is always based on the original image size**, not the imported Texture2D size.
|
|
31
|
+
|
|
32
|
+
**Original Image Size:**
|
|
33
|
+
- The dimensions of the source image file before import
|
|
34
|
+
- Example: 4096x4096 PNG file
|
|
35
|
+
|
|
36
|
+
**Imported Texture2D Size:**
|
|
37
|
+
- The actual texture size after import
|
|
38
|
+
- Can be **smaller** due to:
|
|
39
|
+
- Platform-specific texture size limitations (e.g., mobile max 2048x2048)
|
|
40
|
+
- Texture compression settings
|
|
41
|
+
- Max texture size in import settings
|
|
42
|
+
|
|
43
|
+
### Important Implications
|
|
44
|
+
|
|
45
|
+
1. **All sprite data uses original coordinates:**
|
|
46
|
+
- Sprite rectangles (rect)
|
|
47
|
+
- Borders (for 9-slicing)
|
|
48
|
+
- Pivots
|
|
49
|
+
- Outline coordinates
|
|
50
|
+
|
|
51
|
+
2. **Example:**
|
|
52
|
+
- Original image: 4096x4096 PNG
|
|
53
|
+
- Imported texture: 2048x2048 (due to max size setting)
|
|
54
|
+
- Sprite rect: `(0, 0, 4096, 4096)` ← Still uses original dimensions!
|
|
55
|
+
|
|
56
|
+
3. **Unity handles scaling internally** when rendering sprites
|
|
57
|
+
|
|
58
|
+
4. **Always work in original image coordinate space** when editing sprite data
|
|
59
|
+
|
|
60
|
+
### Critical for Slicing Operations
|
|
61
|
+
|
|
62
|
+
When performing slicing (automatic, grid, isometric), you **MUST ensure the texture being sliced matches the original source image size**.
|
|
63
|
+
|
|
64
|
+
If the imported Texture2D is smaller than original:
|
|
65
|
+
- Slicing coordinates will be incorrect
|
|
66
|
+
- Sprite rectangles won't align with intended regions
|
|
67
|
+
- The operation will fail
|
|
68
|
+
|
|
69
|
+
**Solution:** Use `GetTextureToSlice` utility (see scripts/README.md) to ensure correct texture dimensions for slicing.
|
|
70
|
+
|
|
71
|
+
## Importer Compatibility
|
|
72
|
+
|
|
73
|
+
### TextureImporter Configuration
|
|
74
|
+
|
|
75
|
+
For TextureImporter to support sprites:
|
|
76
|
+
- `textureType` must be `TextureImporterType.Sprite`
|
|
77
|
+
- `spriteImportMode` must be `SpriteImportMode.Multiple` for multiple sprites
|
|
78
|
+
|
|
79
|
+
The pre-flight check automatically configures these settings.
|
|
80
|
+
|
|
81
|
+
### Other Importers
|
|
82
|
+
|
|
83
|
+
PSBImporter and custom importers may have different configuration requirements. Always verify ISpriteEditorDataProvider support before attempting sprite operations.
|
|
84
|
+
|
|
85
|
+
### Data Provider Initialization
|
|
86
|
+
|
|
87
|
+
See [templates.md](templates.md) for the standard initialization pattern. If `dataProvider` is null, the importer does not support sprite editing.
|
|
88
|
+
|
|
89
|
+
## Version-Specific Requirements
|
|
90
|
+
|
|
91
|
+
### Unity 2021.2+
|
|
92
|
+
|
|
93
|
+
Adding or removing sprites requires additional steps:
|
|
94
|
+
|
|
95
|
+
```csharp
|
|
96
|
+
var nameFileIdProvider = dataProvider.GetDataProvider<ISpriteNameFileIdDataProvider>();
|
|
97
|
+
if (nameFileIdProvider != null)
|
|
98
|
+
{
|
|
99
|
+
// Get existing name-file ID pairs
|
|
100
|
+
var nameFileIdPairs = nameFileIdProvider.GetNameFileIdPairs();
|
|
101
|
+
|
|
102
|
+
// Update pairs when adding/removing sprites
|
|
103
|
+
// Add new pair: nameFileIdPairs.Add(new SpriteNameFileIdPair(name, fileId));
|
|
104
|
+
// Remove pair: nameFileIdPairs.RemoveAll(p => p.name == spriteName);
|
|
105
|
+
|
|
106
|
+
nameFileIdProvider.SetNameFileIdPairs(nameFileIdPairs);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Unity 2021.1 and Earlier
|
|
111
|
+
|
|
112
|
+
ISpriteNameFileIdDataProvider does not exist. Simply use SetSpriteRects() without additional steps.
|