unity-async
GitHub提供Unity运行时任务调度与生命周期管理建议,指导在Update、协程、UniTask等方案中做出最佳选择,并规范取消处理与资源清理策略。
Trigger Scenarios
Install
npx skills add Besty0728/Unity-Skills --skill unity-async -g -y
SKILL.md
Frontmatter
{
"name": "unity-async",
"description": "Advise on Unity async and lifecycle strategy"
}
Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via
GET /skills/recommend?includeSchema=true) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.
Triggers
- Choosing Update/coroutine/UniTask/timer
- Handling cancellation and cleanup
- 在 Update/协程/UniTask/定时器间取舍、处理取消与清理
Unity Async Strategy
Use this skill when the user is deciding how runtime work should be scheduled or cleaned up.
Guardrails
Mode: Documentation only — no REST skills to gate; load freely under any operating mode (Approval / Auto / Bypass).
- Do not recommend
UniTaskjust because it looks more advanced than coroutine. - Prefer the simplest scheduling model that fits the use case.
Decision Ladder
- First ask whether the task needs per-frame work at all.
- If not, prefer events, callbacks, or explicit method calls.
- If a short Unity-bound sequence is needed, prefer coroutine.
- Recommend
UniTaskonly when:- the project already uses it, or
- the user explicitly wants it and accepts the dependency.
- Use
Updateonly for true continuous simulation, polling, or input loops that cannot be event-driven.
Specific Guidance
- Avoid many unrelated
Updatemethods if a more event-driven flow works. - Cache references used in hot paths.
- Always define lifecycle ownership:
- who starts the work
- who cancels or stops it
- when it is cleaned up
- In
MonoBehaviour, preferOnEnable/OnDisable/OnDestroyfor subscribe-unsubscribe symmetry. - Use
IDisposablemainly for pure C# lifetimes, temporary subscriptions, or scope-based cleanup helpers, not as a cargo-cult replacement for Unity lifecycle methods.
Output Format
- Recommended scheduling model
- Why it fits
- Lifecycle / cancellation owner
- Hot-path risks
- Why the heavier alternative is unnecessary, if applicable
Version History
-
5ee8388
Current 2026-08-17 04:09
精简主文档体积,新增模式指南及多个模块的顾问式提示,优化描述格式并更新版本锚点。
- 25d511e 2026-08-13 09:13
- ec9f870 2026-07-05 14:39


