ComponentTask-Unity

    Tests GitHub release License: MIT

    Unity package for running dotnet Task and Task<T> scoped to Unity components.

    Description

    Common problem with using c# async methods in Unity is that they have no concept of a component life-time. So unlike Coroutines when you 'start' a task and then destroy the component (by loading a new scene for example) the task does not stop. Most of the time leading to UnityEngine.MissingReferenceException when you try to access members of the component after it has been destroyed on the Unity side. And as a workaround you have to write ugly 'if (!this) return;' guards after every await.

    This library aims to fix that problem by allowing you to run tasks 'on' your MonoBehaviour with very similar behaviour as Unity's Coroutines.

    Documentation

    • Install
    • How To
    • Examples
    • Api Reference

    Repository

    GitHub issues PRs Welcome

    CI

    Basic Azure pipeline for running tests: Pipeline.

    • Improve this Doc
    Back to top ComponentTask documentation