@musashishao/agent-kit 1.8.2 → 1.9.1
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/.agent/agents/ai-architect.md +39 -0
- package/.agent/agents/ai-asset-factory.md +700 -0
- package/.agent/agents/ai-audio-factory.md +503 -0
- package/.agent/agents/cloud-engineer.md +39 -0
- package/.agent/agents/game-developer.md +190 -89
- package/.agent/agents/marketing-specialist.md +41 -0
- package/.agent/agents/orchestrator.md +113 -3
- package/.agent/agents/penetration-tester.md +15 -1
- package/.agent/agents/project-planner.md +67 -0
- package/.agent/agents/unity-mobile-master.md +949 -0
- package/.agent/mcp/config/registry.json +65 -51
- package/.agent/mcp/servers/notebooklm/README.md +114 -0
- package/.agent/mcp/servers/notebooklm/package.json +35 -0
- package/.agent/mcp/servers/notebooklm/src/auth/chrome.ts +225 -0
- package/.agent/mcp/servers/notebooklm/src/auth/index.ts +1 -0
- package/.agent/mcp/servers/notebooklm/src/index.ts +516 -0
- package/.agent/mcp/servers/notebooklm/src/services/index.ts +3 -0
- package/.agent/mcp/servers/notebooklm/src/services/library.ts +217 -0
- package/.agent/mcp/servers/notebooklm/src/services/notebooklm.ts +380 -0
- package/.agent/mcp/servers/notebooklm/tsconfig.json +15 -0
- package/.agent/mcp-gateway/README.md +169 -20
- package/.agent/mcp-gateway/package.json +22 -7
- package/.agent/mcp-gateway/src/auth/index.ts +55 -0
- package/.agent/mcp-gateway/src/auth/middleware.ts +242 -0
- package/.agent/mcp-gateway/src/auth/oauth.ts +462 -0
- package/.agent/mcp-gateway/src/auth/scopes.ts +227 -0
- package/.agent/mcp-gateway/src/index.ts +252 -105
- package/.agent/mcp-gateway/src/observability/index.ts +5 -0
- package/.agent/mcp-gateway/src/observability/otel.ts +405 -0
- package/.agent/mcp-gateway/src/transports/index.ts +5 -0
- package/.agent/mcp-gateway/src/transports/streamableHttp.ts +235 -0
- package/.agent/rules/CODEX.md +115 -2
- package/.agent/rules/CODE_RULES.md +73 -0
- package/.agent/rules/GEMINI.md +26 -1
- package/.agent/rules/MEMORY_STATE.md +110 -0
- package/.agent/rules/REFERENCE.md +40 -58
- package/.agent/rules/REF_SKILLS.md +116 -0
- package/.agent/rules/REF_WORKFLOWS.md +81 -0
- package/.agent/scripts/ak_cli.py +106 -5
- package/.agent/scripts/memory_manager.py +48 -9
- package/.agent/skills/3d-web-experience/SKILL.md +386 -0
- package/.agent/skills/DEPENDENCIES.md +54 -0
- package/.agent/skills/ab-test-setup/SKILL.md +77 -0
- package/.agent/skills/active-directory-attacks/SKILL.md +59 -0
- package/.agent/skills/agent-evaluation/SKILL.md +430 -0
- package/.agent/skills/agent-memory-systems/SKILL.md +426 -0
- package/.agent/skills/agent-tool-builder/SKILL.md +139 -0
- package/.agent/skills/ai-agents-architect/SKILL.md +115 -0
- package/.agent/skills/ai-product/SKILL.md +86 -0
- package/.agent/skills/ai-wrapper-product/SKILL.md +90 -0
- package/.agent/skills/analytics-tracking/SKILL.md +88 -0
- package/.agent/skills/anti-hallucination/SKILL.md +295 -0
- package/.agent/skills/anti-hallucination/scripts/check_hallucination.py +299 -0
- package/.agent/skills/api-fuzzing-bug-bounty/SKILL.md +66 -0
- package/.agent/skills/app-store-optimization/SKILL.md +66 -0
- package/.agent/skills/autonomous-agent-patterns/SKILL.md +414 -0
- package/.agent/skills/aws-penetration-testing/SKILL.md +50 -0
- package/.agent/skills/aws-serverless/SKILL.md +327 -0
- package/.agent/skills/azure-functions/SKILL.md +340 -0
- package/.agent/skills/bifurcation-analysis/SKILL.md +56 -0
- package/.agent/skills/brainstorming/SKILL.md +80 -6
- package/.agent/skills/broken-authentication/SKILL.md +53 -0
- package/.agent/skills/browser-automation/SKILL.md +408 -0
- package/.agent/skills/browser-extension-builder/SKILL.md +422 -0
- package/.agent/skills/bullmq-specialist/SKILL.md +424 -0
- package/.agent/skills/bun-development/SKILL.md +386 -0
- package/.agent/skills/burp-suite-testing/SKILL.md +60 -0
- package/.agent/skills/clerk-auth/SKILL.md +432 -0
- package/.agent/skills/cloud-penetration-testing/SKILL.md +51 -0
- package/.agent/skills/copywriting/SKILL.md +66 -0
- package/.agent/skills/crewai/SKILL.md +470 -0
- package/.agent/skills/decision-memory/SKILL.md +317 -0
- package/.agent/skills/discord-bot-architect/SKILL.md +447 -0
- package/.agent/skills/email-sequence/SKILL.md +73 -0
- package/.agent/skills/emergence-detector/SKILL.md +230 -0
- package/.agent/skills/emergence-detector/scripts/check_emergence.py +265 -0
- package/.agent/skills/ethical-hacking-methodology/SKILL.md +67 -0
- package/.agent/skills/explained-qa/SKILL.md +142 -0
- package/.agent/skills/explained-qa/game-terminology.md +214 -0
- package/.agent/skills/firebase/SKILL.md +377 -0
- package/.agent/skills/game-development/ai-dialogue-engine/SKILL.md +442 -0
- package/.agent/skills/game-development/ai-graphics-generator/SKILL.md +463 -0
- package/.agent/skills/game-development/ai-playtest-framework/SKILL.md +570 -0
- package/.agent/skills/game-development/camera-systems/SKILL.md +607 -0
- package/.agent/skills/game-development/card-battle-engine/SKILL.md +618 -0
- package/.agent/skills/game-development/character-controller-3d/SKILL.md +908 -0
- package/.agent/skills/game-development/cloud-save-sync/SKILL.md +527 -0
- package/.agent/skills/game-development/combat-system/SKILL.md +748 -0
- package/.agent/skills/game-development/compliance-rating/SKILL.md +277 -0
- package/.agent/skills/game-development/crossplatform-build/SKILL.md +386 -0
- package/.agent/skills/game-development/cultivation-progression/SKILL.md +520 -0
- package/.agent/skills/game-development/data-driven-balance/SKILL.md +535 -0
- package/.agent/skills/game-development/game-analytics-integrator/SKILL.md +410 -0
- package/.agent/skills/game-development/game-audio-advanced/SKILL.md +646 -0
- package/.agent/skills/game-development/game-economy-designer/SKILL.md +375 -0
- package/.agent/skills/game-development/game-marketing/SKILL.md +85 -0
- package/.agent/skills/game-development/game-state-manager/SKILL.md +883 -0
- package/.agent/skills/game-development/godot-expert/SKILL.md +462 -0
- package/.agent/skills/game-development/hybrid-game-spec/SKILL.md +220 -0
- package/.agent/skills/game-development/inventory-quest/SKILL.md +747 -0
- package/.agent/skills/game-development/liveops/SKILL.md +308 -0
- package/.agent/skills/game-development/localization/SKILL.md +286 -0
- package/.agent/skills/game-development/mobile-input-patterns/SKILL.md +343 -0
- package/.agent/skills/game-development/monetization-strategy/SKILL.md +94 -0
- package/.agent/skills/game-development/multiplayer-master/SKILL.md +727 -0
- package/.agent/skills/game-development/narrative-branching/SKILL.md +593 -0
- package/.agent/skills/game-development/npc-ai-integration/SKILL.md +110 -0
- package/.agent/skills/game-development/procedural-generation/SKILL.md +168 -0
- package/.agent/skills/game-development/procedural-level-ai/SKILL.md +367 -0
- package/.agent/skills/game-development/prototyping-rapid/SKILL.md +205 -0
- package/.agent/skills/game-development/spec-ecosystem/SKILL.md +155 -0
- package/.agent/skills/game-development/spec-ecosystem/decision-log-format.md +129 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/PLAN-template.md +178 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/SPEC-template.md +110 -0
- package/.agent/skills/game-development/spec-ecosystem/templates/TASKS-template.md +156 -0
- package/.agent/skills/game-development/survival-systems/SKILL.md +493 -0
- package/.agent/skills/game-development/testing-qa/SKILL.md +270 -0
- package/.agent/skills/game-development/unity-integration/SKILL.md +358 -0
- package/.agent/skills/game-development/unity-mobile-optimization/SKILL.md +271 -0
- package/.agent/skills/game-development/webgpu-shading/SKILL.md +209 -0
- package/.agent/skills/gcp-cloud-run/SKILL.md +358 -0
- package/.agent/skills/graphql/SKILL.md +492 -0
- package/.agent/skills/idor-testing/SKILL.md +64 -0
- package/.agent/skills/inngest/SKILL.md +128 -0
- package/.agent/skills/intent-capture/SKILL.md +65 -0
- package/.agent/skills/langfuse/SKILL.md +415 -0
- package/.agent/skills/langgraph/SKILL.md +360 -0
- package/.agent/skills/launch-strategy/SKILL.md +68 -0
- package/.agent/skills/linux-privilege-escalation/SKILL.md +62 -0
- package/.agent/skills/llm-app-patterns/SKILL.md +367 -0
- package/.agent/skills/marketing-ideas/SKILL.md +66 -0
- package/.agent/skills/mcp-composition/SKILL.md +362 -0
- package/.agent/skills/mcp-observability/SKILL.md +323 -0
- package/.agent/skills/mcp-security/SKILL.md +314 -0
- package/.agent/skills/metasploit-framework/SKILL.md +60 -0
- package/.agent/skills/micro-saas-launcher/SKILL.md +93 -0
- package/.agent/skills/neon-postgres/SKILL.md +339 -0
- package/.agent/skills/paid-ads/SKILL.md +64 -0
- package/.agent/skills/supabase-integration/SKILL.md +411 -0
- package/.agent/skills/trust-spectrum/SKILL.md +291 -0
- package/.agent/skills/vibe-coding-guard/SKILL.md +328 -0
- package/.agent/templates/AGENTS.game.md +63 -0
- package/.agent/templates/docs/WORKFLOW_GUIDE.en.md +100 -0
- package/.agent/templates/docs/WORKFLOW_GUIDE.vi.md +100 -0
- package/.agent/workflows/ai-agent.md +38 -0
- package/.agent/workflows/autofix.md +1 -0
- package/.agent/workflows/brainstorm.md +1 -0
- package/.agent/workflows/context.md +1 -0
- package/.agent/workflows/create.md +39 -8
- package/.agent/workflows/dashboard.md +1 -0
- package/.agent/workflows/debug.md +14 -0
- package/.agent/workflows/deploy.md +14 -0
- package/.agent/workflows/enhance.md +44 -0
- package/.agent/workflows/gamekit-init.md +177 -0
- package/.agent/workflows/gamekit-launch.md +338 -0
- package/.agent/workflows/gamekit-plan.md +204 -0
- package/.agent/workflows/gamekit-qa.md +153 -0
- package/.agent/workflows/gamekit-spec.md +243 -0
- package/.agent/workflows/gamekit-tasks.md +208 -0
- package/.agent/workflows/marketing.md +39 -0
- package/.agent/workflows/next.md +1 -0
- package/.agent/workflows/orchestrate.md +12 -0
- package/.agent/workflows/pentest.md +39 -0
- package/.agent/workflows/plan.md +42 -0
- package/.agent/workflows/preview.md +1 -0
- package/.agent/workflows/quality.md +1 -0
- package/.agent/workflows/saas.md +38 -0
- package/.agent/workflows/spec.md +42 -0
- package/.agent/workflows/status.md +1 -0
- package/.agent/workflows/test.md +14 -0
- package/.agent/workflows/ui-ux-pro-max.md +1 -0
- package/README.md +4 -4
- package/bin/cli.js +411 -111
- package/package.json +1 -2
- package/docs/AI_DATA_INFRASTRUCTURE.md +0 -288
- package/docs/CHANGELOG_AI_INFRA.md +0 -111
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-qa
|
|
3
|
+
description: Comprehensive QA and testing patterns for games. Playtesting, alpha/beta phases, bug triage, performance testing, and automated testing for Unity.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Game Testing & QA Skill
|
|
7
|
+
|
|
8
|
+
> **Purpose**: Systematic quality assurance for game development.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
- Preparing for alpha/beta release
|
|
12
|
+
- Setting up automated test suites
|
|
13
|
+
- Organizing playtesting sessions
|
|
14
|
+
- Debugging production issues
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. Testing Phases
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
22
|
+
│ TESTING LIFECYCLE │
|
|
23
|
+
├─────────────────────────────────────────────────────────────┤
|
|
24
|
+
│ DEV TEST → ALPHA → CLOSED BETA → OPEN BETA → RELEASE │
|
|
25
|
+
│ ↓ ↓ ↓ ↓ ↓ │
|
|
26
|
+
│ Internal Friends Invited Public Everyone │
|
|
27
|
+
│ Team only & Family Testers Testers │
|
|
28
|
+
└─────────────────────────────────────────────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Phase Goals
|
|
32
|
+
| Phase | Focus | Testers |
|
|
33
|
+
|-------|-------|---------|
|
|
34
|
+
| **Dev Test** | Core mechanics work | Team only |
|
|
35
|
+
| **Alpha** | Feature complete, major bugs | 10-50 |
|
|
36
|
+
| **Closed Beta** | Balance, UX, edge cases | 100-1000 |
|
|
37
|
+
| **Open Beta** | Scale, server load, final polish | Unlimited |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 2. Playtesting Sessions
|
|
42
|
+
|
|
43
|
+
### Session Structure
|
|
44
|
+
```markdown
|
|
45
|
+
## Playtest Session Plan
|
|
46
|
+
|
|
47
|
+
**Duration**: 30-60 minutes
|
|
48
|
+
**Testers**: [X] people
|
|
49
|
+
**Build**: v[X.X.X]
|
|
50
|
+
|
|
51
|
+
### Pre-Session (5 min)
|
|
52
|
+
- Explain purpose (not testing player, testing game)
|
|
53
|
+
- No hints during play
|
|
54
|
+
- Think-aloud protocol
|
|
55
|
+
|
|
56
|
+
### Observation (20-40 min)
|
|
57
|
+
- Silent observation
|
|
58
|
+
- Note confusion points
|
|
59
|
+
- Track completion times
|
|
60
|
+
|
|
61
|
+
### Post-Session (10-15 min)
|
|
62
|
+
- Open questions first
|
|
63
|
+
- Then specific questions
|
|
64
|
+
- Collect written feedback
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Observation Checklist
|
|
68
|
+
- [ ] Where did player get stuck?
|
|
69
|
+
- [ ] What did player try that didn't work?
|
|
70
|
+
- [ ] What did player miss?
|
|
71
|
+
- [ ] What caused frustration?
|
|
72
|
+
- [ ] What caused joy?
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 3. Bug Triage System
|
|
77
|
+
|
|
78
|
+
### Severity Classification
|
|
79
|
+
| Severity | Definition | Response Time |
|
|
80
|
+
|----------|------------|---------------|
|
|
81
|
+
| **S1 - Critical** | Game unplayable, data loss, crash | Immediate |
|
|
82
|
+
| **S2 - Major** | Feature broken, blocking progression | 24 hours |
|
|
83
|
+
| **S3 - Minor** | Annoying but workaround exists | Next sprint |
|
|
84
|
+
| **S4 - Trivial** | Cosmetic, typo, minor polish | Backlog |
|
|
85
|
+
|
|
86
|
+
### Bug Report Template
|
|
87
|
+
```markdown
|
|
88
|
+
## Bug: [Short Description]
|
|
89
|
+
|
|
90
|
+
**Severity**: S[1-4]
|
|
91
|
+
**Platform**: [iOS/Android/PC]
|
|
92
|
+
**Build**: v[X.X.X]
|
|
93
|
+
|
|
94
|
+
### Steps to Reproduce
|
|
95
|
+
1. [Step 1]
|
|
96
|
+
2. [Step 2]
|
|
97
|
+
3. [Step 3]
|
|
98
|
+
|
|
99
|
+
### Expected Behavior
|
|
100
|
+
[What should happen]
|
|
101
|
+
|
|
102
|
+
### Actual Behavior
|
|
103
|
+
[What actually happens]
|
|
104
|
+
|
|
105
|
+
### Evidence
|
|
106
|
+
[Screenshot/Video/Logs]
|
|
107
|
+
|
|
108
|
+
### Additional Context
|
|
109
|
+
[Device, OS version, etc.]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 4. Performance Testing
|
|
115
|
+
|
|
116
|
+
### Target Metrics
|
|
117
|
+
| Metric | Mobile Target | PC Target |
|
|
118
|
+
|--------|---------------|-----------|
|
|
119
|
+
| **FPS** | 30-60 stable | 60+ stable |
|
|
120
|
+
| **Frame Time** | <33ms | <16ms |
|
|
121
|
+
| **Memory** | <500MB | <2GB |
|
|
122
|
+
| **Load Time** | <5s | <3s |
|
|
123
|
+
| **Battery Drain** | <10%/hour | N/A |
|
|
124
|
+
|
|
125
|
+
### Performance Test Checklist
|
|
126
|
+
- [ ] Profile on lowest target device
|
|
127
|
+
- [ ] Test full session (30+ min)
|
|
128
|
+
- [ ] Monitor thermal throttling
|
|
129
|
+
- [ ] Check memory leaks
|
|
130
|
+
- [ ] Measure after 100 entity spawns
|
|
131
|
+
|
|
132
|
+
### Unity Profiler Commands
|
|
133
|
+
```csharp
|
|
134
|
+
// Frame timing
|
|
135
|
+
Profiler.BeginSample("MySystem");
|
|
136
|
+
// ... code ...
|
|
137
|
+
Profiler.EndSample();
|
|
138
|
+
|
|
139
|
+
// Memory snapshot
|
|
140
|
+
UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 5. Automated Testing (Unity)
|
|
146
|
+
|
|
147
|
+
### Test Types
|
|
148
|
+
|
|
149
|
+
| Type | Purpose | Location |
|
|
150
|
+
|------|---------|----------|
|
|
151
|
+
| **Edit Mode** | Logic, utilities, pure C# | `Tests/Editor/` |
|
|
152
|
+
| **Play Mode** | Runtime, MonoBehaviour | `Tests/Runtime/` |
|
|
153
|
+
| **Integration** | Full systems together | `Tests/Integration/` |
|
|
154
|
+
|
|
155
|
+
### Edit Mode Test Example
|
|
156
|
+
```csharp
|
|
157
|
+
// Tests/Editor/CombatTests.cs
|
|
158
|
+
using NUnit.Framework;
|
|
159
|
+
|
|
160
|
+
[TestFixture]
|
|
161
|
+
public class CombatTests
|
|
162
|
+
{
|
|
163
|
+
[Test]
|
|
164
|
+
public void Damage_ReducesHealth()
|
|
165
|
+
{
|
|
166
|
+
var health = new HealthComponent(100);
|
|
167
|
+
health.TakeDamage(25);
|
|
168
|
+
Assert.AreEqual(75, health.CurrentHealth);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[Test]
|
|
172
|
+
public void Damage_CannotGoBelowZero()
|
|
173
|
+
{
|
|
174
|
+
var health = new HealthComponent(50);
|
|
175
|
+
health.TakeDamage(100);
|
|
176
|
+
Assert.AreEqual(0, health.CurrentHealth);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Play Mode Test Example
|
|
182
|
+
```csharp
|
|
183
|
+
// Tests/Runtime/PlayerMovementTests.cs
|
|
184
|
+
using System.Collections;
|
|
185
|
+
using NUnit.Framework;
|
|
186
|
+
using UnityEngine;
|
|
187
|
+
using UnityEngine.TestTools;
|
|
188
|
+
|
|
189
|
+
public class PlayerMovementTests
|
|
190
|
+
{
|
|
191
|
+
private GameObject _player;
|
|
192
|
+
|
|
193
|
+
[SetUp]
|
|
194
|
+
public void Setup()
|
|
195
|
+
{
|
|
196
|
+
_player = new GameObject("Player");
|
|
197
|
+
_player.AddComponent<PlayerController>();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
[TearDown]
|
|
201
|
+
public void Teardown()
|
|
202
|
+
{
|
|
203
|
+
Object.Destroy(_player);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
[UnityTest]
|
|
207
|
+
public IEnumerator Player_MovesRight_WhenInputPositive()
|
|
208
|
+
{
|
|
209
|
+
var controller = _player.GetComponent<PlayerController>();
|
|
210
|
+
var startPos = _player.transform.position;
|
|
211
|
+
|
|
212
|
+
controller.SimulateInput(Vector2.right);
|
|
213
|
+
yield return new WaitForSeconds(0.5f);
|
|
214
|
+
|
|
215
|
+
Assert.Greater(_player.transform.position.x, startPos.x);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 6. Regression Testing
|
|
223
|
+
|
|
224
|
+
### When to Run
|
|
225
|
+
- Before every release
|
|
226
|
+
- After major feature merge
|
|
227
|
+
- After engine update
|
|
228
|
+
- After platform SDK update
|
|
229
|
+
|
|
230
|
+
### Regression Checklist
|
|
231
|
+
- [ ] All save files load correctly
|
|
232
|
+
- [ ] Tutorial completes without errors
|
|
233
|
+
- [ ] IAP flow works (sandbox)
|
|
234
|
+
- [ ] Ads display and reward correctly
|
|
235
|
+
- [ ] Analytics events fire
|
|
236
|
+
- [ ] All levels completable
|
|
237
|
+
- [ ] No new crashes in crash reporter
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 7. Test Coverage Guidelines
|
|
242
|
+
|
|
243
|
+
| System | Required Coverage |
|
|
244
|
+
|--------|-------------------|
|
|
245
|
+
| **Save/Load** | 90%+ (critical) |
|
|
246
|
+
| **Economy** | 80%+ (balance-sensitive) |
|
|
247
|
+
| **Combat** | 70%+ (core mechanic) |
|
|
248
|
+
| **UI Navigation** | 50%+ (regression) |
|
|
249
|
+
| **Visual Polish** | Manual only |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Anti-Patterns
|
|
254
|
+
|
|
255
|
+
| ❌ Don't | ✅ Do |
|
|
256
|
+
|----------|-------|
|
|
257
|
+
| Test only happy path | Test edge cases |
|
|
258
|
+
| Skip low-end device testing | Test on min spec |
|
|
259
|
+
| Rely only on team testing | Use external testers |
|
|
260
|
+
| Fix all bugs at once | Prioritize by severity |
|
|
261
|
+
| Ship without regression | Run full suite before release |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Related Skills
|
|
266
|
+
- `game-development/game-analytics-integrator`
|
|
267
|
+
- `game-development/unity-integration`
|
|
268
|
+
|
|
269
|
+
## Related Workflows
|
|
270
|
+
- `/game-launch` - Includes pre-launch audit
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unity-integration
|
|
3
|
+
description: Unity Engine expert skill covering C# scripting, DOTS/ECS, Unity 6 features, XR development, and AI integration with ML-Agents and Sentis. Use when developing games with Unity.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, WebSearch
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Unity Integration Skill
|
|
8
|
+
|
|
9
|
+
> Expert-level Unity development patterns for Unity 6 (2025+).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
- Building games with Unity Engine
|
|
16
|
+
- Implementing Unity-specific patterns (C#, MonoBehaviour, DOTS)
|
|
17
|
+
- Optimizing Unity performance
|
|
18
|
+
- Integrating AI with ML-Agents or Sentis
|
|
19
|
+
- Developing XR experiences with Unity XR
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Unity 6 Key Features (2025)
|
|
24
|
+
|
|
25
|
+
| Feature | Description | Use When |
|
|
26
|
+
|---------|-------------|----------|
|
|
27
|
+
| **GPU Resident Drawer** | Automatic GPU instancing | Large open worlds |
|
|
28
|
+
| **Multiplayer Center** | Netcode setup wizard | Multiplayer games |
|
|
29
|
+
| **Sentis** | On-device AI inference | ML in production |
|
|
30
|
+
| **Adaptive Probe Volumes** | Dynamic GI for open worlds | Large outdoor scenes |
|
|
31
|
+
| **DOTS Entities 1.0** | Stable ECS | Performance-critical |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Architecture Patterns
|
|
36
|
+
|
|
37
|
+
### 1. MonoBehaviour vs DOTS Decision
|
|
38
|
+
|
|
39
|
+
| Factor | MonoBehaviour | DOTS/ECS |
|
|
40
|
+
|--------|---------------|----------|
|
|
41
|
+
| **Entity Count** | < 1000 | > 1000 |
|
|
42
|
+
| **Team Experience** | Any | Advanced |
|
|
43
|
+
| **Development Speed** | Fast | Slower |
|
|
44
|
+
| **Performance** | Good | Excellent |
|
|
45
|
+
| **Debugging** | Easy | Complex |
|
|
46
|
+
|
|
47
|
+
**Recommendation**: Start with MonoBehaviour. Migrate to DOTS only when profiler shows need.
|
|
48
|
+
|
|
49
|
+
### 2. Recommended Project Structure
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Assets/
|
|
53
|
+
├── _Project/ # Your game code
|
|
54
|
+
│ ├── Scripts/
|
|
55
|
+
│ │ ├── Core/ # Singletons, managers
|
|
56
|
+
│ │ ├── Gameplay/ # Game-specific logic
|
|
57
|
+
│ │ ├── UI/ # UI controllers
|
|
58
|
+
│ │ └── Utils/ # Helper classes
|
|
59
|
+
│ ├── Prefabs/
|
|
60
|
+
│ ├── Scenes/
|
|
61
|
+
│ └── ScriptableObjects/
|
|
62
|
+
├── Art/ # Art assets
|
|
63
|
+
├── Audio/ # Audio assets
|
|
64
|
+
├── Plugins/ # Third-party
|
|
65
|
+
└── Resources/ # Runtime-loaded (use sparingly)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Dependency Injection Pattern
|
|
69
|
+
|
|
70
|
+
```csharp
|
|
71
|
+
// Instead of FindObjectOfType or Singletons, use explicit injection
|
|
72
|
+
public class PlayerController : MonoBehaviour
|
|
73
|
+
{
|
|
74
|
+
[SerializeField] private GameManager _gameManager;
|
|
75
|
+
[SerializeField] private AudioManager _audioManager;
|
|
76
|
+
|
|
77
|
+
// Dependencies are visible in Inspector
|
|
78
|
+
// Testable and mockable
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## C# Best Practices for Unity
|
|
85
|
+
|
|
86
|
+
### 1. Avoid Allocations in Update
|
|
87
|
+
|
|
88
|
+
```csharp
|
|
89
|
+
// ❌ BAD - Allocates every frame
|
|
90
|
+
void Update()
|
|
91
|
+
{
|
|
92
|
+
var enemies = FindObjectsOfType<Enemy>();
|
|
93
|
+
string debug = $"Enemies: {enemies.Length}";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ✅ GOOD - Cache and reuse
|
|
97
|
+
private Enemy[] _enemyCache = new Enemy[100];
|
|
98
|
+
private StringBuilder _sb = new StringBuilder();
|
|
99
|
+
|
|
100
|
+
void Update()
|
|
101
|
+
{
|
|
102
|
+
int count = Physics.OverlapSphereNonAlloc(pos, radius, _enemyCache);
|
|
103
|
+
_sb.Clear();
|
|
104
|
+
_sb.Append("Enemies: ").Append(count);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2. Object Pooling
|
|
109
|
+
|
|
110
|
+
```csharp
|
|
111
|
+
public class BulletPool : MonoBehaviour
|
|
112
|
+
{
|
|
113
|
+
[SerializeField] private GameObject _bulletPrefab;
|
|
114
|
+
[SerializeField] private int _poolSize = 100;
|
|
115
|
+
|
|
116
|
+
private Queue<GameObject> _pool = new Queue<GameObject>();
|
|
117
|
+
|
|
118
|
+
void Awake()
|
|
119
|
+
{
|
|
120
|
+
for (int i = 0; i < _poolSize; i++)
|
|
121
|
+
{
|
|
122
|
+
var bullet = Instantiate(_bulletPrefab);
|
|
123
|
+
bullet.SetActive(false);
|
|
124
|
+
_pool.Enqueue(bullet);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public GameObject Get()
|
|
129
|
+
{
|
|
130
|
+
if (_pool.Count == 0) return Instantiate(_bulletPrefab);
|
|
131
|
+
var bullet = _pool.Dequeue();
|
|
132
|
+
bullet.SetActive(true);
|
|
133
|
+
return bullet;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public void Return(GameObject bullet)
|
|
137
|
+
{
|
|
138
|
+
bullet.SetActive(false);
|
|
139
|
+
_pool.Enqueue(bullet);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 3. Event System (Zero Allocation)
|
|
145
|
+
|
|
146
|
+
```csharp
|
|
147
|
+
// Define events with Action instead of UnityEvent for perf-critical paths
|
|
148
|
+
public static class GameEvents
|
|
149
|
+
{
|
|
150
|
+
public static event Action<int> OnScoreChanged;
|
|
151
|
+
public static event Action OnPlayerDied;
|
|
152
|
+
|
|
153
|
+
public static void ScoreChanged(int newScore) => OnScoreChanged?.Invoke(newScore);
|
|
154
|
+
public static void PlayerDied() => OnPlayerDied?.Invoke();
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Unity ML-Agents Integration
|
|
161
|
+
|
|
162
|
+
### Setup
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Install ML-Agents
|
|
166
|
+
pip install mlagents
|
|
167
|
+
|
|
168
|
+
# In Unity Package Manager, add:
|
|
169
|
+
# com.unity.ml-agents
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Basic Agent
|
|
173
|
+
|
|
174
|
+
```csharp
|
|
175
|
+
using Unity.MLAgents;
|
|
176
|
+
using Unity.MLAgents.Sensors;
|
|
177
|
+
using Unity.MLAgents.Actuators;
|
|
178
|
+
|
|
179
|
+
public class PlayerAgent : Agent
|
|
180
|
+
{
|
|
181
|
+
[SerializeField] private float _moveSpeed = 5f;
|
|
182
|
+
|
|
183
|
+
public override void CollectObservations(VectorSensor sensor)
|
|
184
|
+
{
|
|
185
|
+
sensor.AddObservation(transform.localPosition);
|
|
186
|
+
sensor.AddObservation(_target.localPosition);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public override void OnActionReceived(ActionBuffers actions)
|
|
190
|
+
{
|
|
191
|
+
float moveX = actions.ContinuousActions[0];
|
|
192
|
+
float moveZ = actions.ContinuousActions[1];
|
|
193
|
+
|
|
194
|
+
transform.localPosition += new Vector3(moveX, 0, moveZ) * _moveSpeed * Time.deltaTime;
|
|
195
|
+
|
|
196
|
+
// Reward shaping
|
|
197
|
+
float distanceToTarget = Vector3.Distance(transform.localPosition, _target.localPosition);
|
|
198
|
+
AddReward(-distanceToTarget * 0.001f);
|
|
199
|
+
|
|
200
|
+
if (distanceToTarget < 1.5f)
|
|
201
|
+
{
|
|
202
|
+
AddReward(1.0f);
|
|
203
|
+
EndEpisode();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public override void Heuristic(in ActionBuffers actionsOut)
|
|
208
|
+
{
|
|
209
|
+
// Human control for testing
|
|
210
|
+
var continuousActions = actionsOut.ContinuousActions;
|
|
211
|
+
continuousActions[0] = Input.GetAxis("Horizontal");
|
|
212
|
+
continuousActions[1] = Input.GetAxis("Vertical");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Unity Sentis (On-Device AI)
|
|
220
|
+
|
|
221
|
+
### Loading and Running ONNX Model
|
|
222
|
+
|
|
223
|
+
```csharp
|
|
224
|
+
using Unity.Sentis;
|
|
225
|
+
|
|
226
|
+
public class AIController : MonoBehaviour
|
|
227
|
+
{
|
|
228
|
+
[SerializeField] private ModelAsset _modelAsset;
|
|
229
|
+
|
|
230
|
+
private Model _model;
|
|
231
|
+
private IWorker _worker;
|
|
232
|
+
|
|
233
|
+
void Start()
|
|
234
|
+
{
|
|
235
|
+
_model = ModelLoader.Load(_modelAsset);
|
|
236
|
+
_worker = WorkerFactory.CreateWorker(BackendType.GPUCompute, _model);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
public float[] Predict(float[] input)
|
|
240
|
+
{
|
|
241
|
+
using var inputTensor = new TensorFloat(new TensorShape(1, input.Length), input);
|
|
242
|
+
_worker.Execute(inputTensor);
|
|
243
|
+
|
|
244
|
+
var outputTensor = _worker.PeekOutput() as TensorFloat;
|
|
245
|
+
outputTensor.MakeReadable();
|
|
246
|
+
|
|
247
|
+
return outputTensor.ToReadOnlyArray();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
void OnDestroy()
|
|
251
|
+
{
|
|
252
|
+
_worker?.Dispose();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Performance Optimization
|
|
260
|
+
|
|
261
|
+
### Profiler Checklist
|
|
262
|
+
|
|
263
|
+
| Metric | Target | Tool |
|
|
264
|
+
|--------|--------|------|
|
|
265
|
+
| Frame Time | < 16.67ms (60fps) | Profiler |
|
|
266
|
+
| GC Allocations | 0 in gameplay | Profiler > GC Alloc |
|
|
267
|
+
| Draw Calls | < 200 mobile, < 2000 PC | Frame Debugger |
|
|
268
|
+
| SetPass Calls | < 100 mobile | Frame Debugger |
|
|
269
|
+
| Physics Time | < 3ms | Physics Debugger |
|
|
270
|
+
|
|
271
|
+
### Quick Wins
|
|
272
|
+
|
|
273
|
+
```csharp
|
|
274
|
+
// 1. Cache GetComponent
|
|
275
|
+
private Rigidbody _rb;
|
|
276
|
+
void Awake() => _rb = GetComponent<Rigidbody>();
|
|
277
|
+
|
|
278
|
+
// 2. Use CompareTag instead of ==
|
|
279
|
+
if (other.CompareTag("Enemy")) // NOT other.tag == "Enemy"
|
|
280
|
+
|
|
281
|
+
// 3. Avoid LINQ in Update
|
|
282
|
+
// ❌ enemies.Where(e => e.IsAlive).ToList()
|
|
283
|
+
// ✅ Manual loop with cached list
|
|
284
|
+
|
|
285
|
+
// 4. Use NonAlloc physics
|
|
286
|
+
Physics.RaycastNonAlloc(ray, _hitBuffer, maxDistance);
|
|
287
|
+
Physics.OverlapSphereNonAlloc(pos, radius, _colliderBuffer);
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## XR Development (Unity XR)
|
|
293
|
+
|
|
294
|
+
### Setup XR Interaction Toolkit
|
|
295
|
+
|
|
296
|
+
```csharp
|
|
297
|
+
// XR Rig setup in code
|
|
298
|
+
using UnityEngine.XR.Interaction.Toolkit;
|
|
299
|
+
|
|
300
|
+
public class XRSetup : MonoBehaviour
|
|
301
|
+
{
|
|
302
|
+
[SerializeField] private XRController _leftController;
|
|
303
|
+
[SerializeField] private XRController _rightController;
|
|
304
|
+
|
|
305
|
+
void Start()
|
|
306
|
+
{
|
|
307
|
+
// Bind inputs
|
|
308
|
+
_rightController.selectAction.action.performed += OnGrab;
|
|
309
|
+
_leftController.activateAction.action.performed += OnActivate;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private void OnGrab(InputAction.CallbackContext ctx)
|
|
313
|
+
{
|
|
314
|
+
// Handle grab input
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### VR Performance Targets
|
|
320
|
+
|
|
321
|
+
| Metric | Quest 2/3 | PC VR |
|
|
322
|
+
|--------|-----------|-------|
|
|
323
|
+
| FPS | 72-90 | 90 |
|
|
324
|
+
| Draw Calls | < 100 | < 300 |
|
|
325
|
+
| Triangles | < 500K | < 2M |
|
|
326
|
+
| Texture Memory | < 1GB | < 4GB |
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Anti-Patterns
|
|
331
|
+
|
|
332
|
+
| ❌ Don't | ✅ Do |
|
|
333
|
+
|----------|-------|
|
|
334
|
+
| `FindObjectOfType` in Update | Cache in Awake |
|
|
335
|
+
| `Resources.Load` at runtime | Addressables |
|
|
336
|
+
| String comparisons for tags | `CompareTag()` |
|
|
337
|
+
| `foreach` with LINQ | `for` loop |
|
|
338
|
+
| Create materials at runtime | Shared materials |
|
|
339
|
+
| Instantiate in hot path | Object pooling |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Quick Reference Commands
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Build from command line
|
|
347
|
+
Unity -quit -batchmode -projectPath . -buildTarget StandaloneWindows64 -buildOutput build.exe
|
|
348
|
+
|
|
349
|
+
# Run tests
|
|
350
|
+
Unity -runTests -testPlatform playmode -testResults results.xml
|
|
351
|
+
|
|
352
|
+
# Import package
|
|
353
|
+
Unity -importPackage package.unitypackage
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
> **Remember:** Unity is a tool, not the game. Profile before optimizing, prototype before polishing.
|