unity-async

Recommend Unity scheduling and lifecycle strategies for asynchronous runtime tasks.

8|1|Updated Oct 7, 2025
One-click install
npx skills add https://github.com/Zzulin/unity-project01 --skill unity-async-zzulin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-async
Source: https://github.com/Zzulin/unity-project01/tree/main/URP1/Plugins/Unity-Skills-main/SkillsForUnity/unity-skills~/skills/async
Command: npx skills add https://github.com/Zzulin/unity-project01 --skill unity-async-zzulin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers struggle to pick the correct Unity scheduling model and lifecycle strategy for runtime work, leading to resource leaks, cancelled tasks not being cleaned up, unnecessary dependencies, or poor performance in hot paths. This Skill provides a clear decision ladder and guardrails to choose between Update, coroutine, UniTask, timers, and IDisposable patterns while ensuring proper ownership and cancellation.

Core Features & Use Cases

  • Decision Ladder: Step-by-step questions to determine whether a task needs per-frame work, short Unity-bound sequencing, or background async handling.
  • Guardrails & Tradeoffs: Advice on when to avoid Update, prefer coroutines, or accept UniTask only when the project already uses it or the dependency is acceptable.
  • Lifecycle & Cancellation Guidance: Recommendations for who starts, who cancels, and when to clean up using OnEnable/OnDisable/OnDestroy, IDisposable, or explicit cancellation tokens.
  • Use Case Examples: Choosing Update for continuous input/polling, coroutines for short sequential animations, timers for infrequent delays, and UniTask when an async ecosystem is established.

Quick Start

Advise whether to use Update, coroutine, UniTask, or a timer for a 3-second UI fade that must cancel on scene unload.

Frequently Asked Questions about unity-async

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Update, coroutines, and UniTask for Unity async tasks?

To choose the right Unity async pattern, use a decision ladder evaluating whether work needs per-frame polling, short sequential animation, or background async handling. Prefer Update for continuous input, coroutines for sequencing, and UniTask only if that async ecosystem is established.

What is the best way to handle Unity coroutine cancellation on scene unload?

Handling Unity coroutine cancellation on scene unload requires explicit lifecycle ownership using OnDisable or OnDestroy. Bind coroutine startup to OnEnable and implement cleanup with IDisposable or cancellation tokens to ensure cancelled tasks are properly cleaned up without resource leaks.

Does UniTask work with MonoBehaviour lifecycle enable and destroy cycles?

UniTask works with MonoBehaviour lifecycle cycles by applying explicit cancellation tokens during OnDisable and OnDestroy. It fits background async handling and network calls, but should only be used if the project already accepts the UniTask dependency to avoid unnecessary overhead.

Why does using Update for infrequent Unity timers cause performance issues in hot paths?

Using Update for infrequent Unity timers causes performance issues in hot paths because continuous per-frame polling wastes cycles when nothing changes. For infrequent delays, dedicated timers or background async scheduling avoid unnecessary frame computations and reduce runtime overhead.

When do I need IDisposable patterns for Unity async task cleanup?

You need IDisposable patterns for Unity async task cleanup when managing background timers or network calls that outlive a single frame. IDisposable specifies lifecycle ownership, ensuring proper cancellation and resource release during MonoBehaviour enable, disable, and destroy cycles.