unitask

Replace coroutines with cancellation-safe UniTask async/await workflows in Unity.

Updated May 6, 2026
One-click install
npx skills add https://github.com/BasarEkinci/memory-card-game --skill unitask-basarekinci
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unitask
Source: https://github.com/BasarEkinci/memory-card-game/tree/main/.claude/skills/third-party/unitask
Command: npx skills add https://github.com/BasarEkinci/memory-card-game --skill unitask-basarekinci

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

UniTask solves unreliable or unsafe asynchronous flows in Unity by providing proper cancellation and PlayerLoop-integrated await support, so work stops cleanly when objects are destroyed.

Core Features & Use Cases

  • Zero-allocation async/await: reduces GC pressure compared to typical async patterns in Unity.
  • First-class cancellation support: requires passing CancellationToken to prevent MissingReferenceException and undefined behavior.
  • PlayerLoop timing control: await specific Unity loop phases (Update, FixedUpdate, initialization/post-late-update) and frame boundaries.
  • Async-friendly Unity APIs: wrap SceneManager, Resources, UnityWebRequest, and Addressables operations with ToUniTask.
  • Common workflow patterns: implement bootstrapping chains, async loops, timeouts, debouncing, and fire-and-forget with error handling.

Quick Start

Replace coroutine-based sequences with UniTask methods that accept a CancellationToken and await Unity operations via ToUniTask for cancellation-safe behavior.

Frequently Asked Questions about unitask

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

FAQPage Schema
How do I write cancellation-safe async workflows in Unity to prevent MissingReferenceException?

Cancellation-safe async workflows in Unity require passing explicit CancellationToken parameters to UniTask methods and properly handling OperationCanceledException, ensuring work stops cleanly when objects are destroyed.

What is the best way to replace Unity coroutines with async-await for zero GC allocation?

Replacing Unity coroutines with async-await is best achieved using UniTask to provide zero-allocation async workflows, significantly reducing GC pressure compared to typical Task-based async patterns.

How do I await specific Unity PlayerLoop timing phases like Update or FixedUpdate?

To await specific Unity PlayerLoop timing phases, UniTask provides PlayerLoopTiming yields that let you await precise loop phases including Update, FixedUpdate, initialization, and post-late-update frame boundaries.

Does UniTask work with standard Unity APIs like SceneManager and UnityWebRequest for async operations?

UniTask works with standard Unity APIs by wrapping SceneManager, Resources, UnityWebRequest, and Addressables operations with ToUniTask, enabling cancellation-safe awaitable workflows for loading pipelines.

Why do I need CancellationToken in Unity async methods and what happens if I omit it?

A CancellationToken in Unity async methods is required to prevent undefined behavior and MissingReferenceException leaks; omitting it means destroyed objects can still be accessed, causing runtime crashes.

Can I implement timeouts and debounced input actions using async-await in Unity?

You can implement timeouts and debounced input actions in Unity using UniTask to create fire-and-forget async loops and workflows with proper error handling and frame-based waiting.