unity-async

Recommend Unity scheduling models and lifecycle ownership for MonoBehaviour workflows.

Updated Apr 15, 2026
One-click install
npx skills add https://github.com/Yuan-Zzzz/FrogRE --skill unity-async-yuan-zzzz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-async
Source: https://github.com/Yuan-Zzzz/FrogRE/tree/main/.codex/skills/unity-skills/skills/async
Command: npx skills add https://github.com/Yuan-Zzzz/FrogRE --skill unity-async-yuan-zzzz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers choose and apply the appropriate Unity scheduling and lifecycle model (Update, coroutine, UniTask, or timers) and design clear cancellation and cleanup ownership to avoid resource leaks, unnecessary dependencies, and performance problems.

Core Features & Use Cases

  • Decision ladder: Guides whether work should be event-driven, coroutine-based, UniTask-based, timer-driven, or implemented in Update for true continuous simulation.
  • Lifecycle & cancellation: Advises who owns start/stop responsibilities, how to unsubscribe in OnDisable/OnDestroy, and when to use IDisposable versus Unity lifecycle methods.
  • Performance guidance: Highlights hot-path risks, caching, and when heavier alternatives are unnecessary.
  • Use Case: Decide between coroutine and UniTask for a cancellable network download started from a UI interaction, or whether to consolidate multiple Update checks into an event-driven system.

Quick Start

Ask for a recommendation: "Recommend whether to use Update, coroutine, UniTask, or a timer for a MonoBehaviour that polls input and starts cancellable downloads, and specify lifecycle ownership and cancellation strategy."

Frequently Asked Questions about unity-async

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

FAQPage Schema
When should I use Unity coroutines versus UniTask for asynchronous workflows?

Use Unity Update for true continuous per-frame simulation like polling input, and coroutines or UniTask for short-lived or cancellable async flows. Event-driven systems should replace multiple Update checks when possible to optimize hot-path performance.

How do I handle cancellation and cleanup for UniTask async flows in Unity?

Define lifecycle ownership explicitly by assigning start and stop responsibilities, passing cancellation tokens to UniTask flows, and unsubscribing during OnDisable or OnDestroy to prevent resource leaks and dangling references.

Does Unity UniTask support cancellation tokens for MonoBehaviour lifecycle management?

UniTask supports CancellationToken natively, allowing you to cancel async flows during MonoBehaviour lifecycle events like OnDisable and OnDestroy. This integration prevents resource leaks when GameObjects are deactivated or destroyed.

What is the best way to choose between Update and a timer for Unity scheduling?

Use Update for true continuous per-frame simulation requiring immediate input polling, and use timers or event-driven systems for discrete scheduled intervals. Consolidating multiple Update checks into events reduces hot-path risks and improves performance.

Why do my Unity coroutines cause resource leaks when the GameObject is destroyed?

Coroutines leak resources when GameObjects are destroyed if start and stop responsibilities are undefined. Without explicit cancellation patterns and cleanup in OnDisable or OnDestroy, dangling references and unresolved subscriptions persist, causing memory leaks.

How do I consolidate multiple Update checks into an event-driven system in Unity?

Consolidate multiple Update checks by shifting to an event-driven architecture where state changes trigger callbacks instead of per-frame polling. This reduces hot-path overhead, minimizes unnecessary dependencies, and improves overall MonoBehaviour performance.