{"id":14960834,"url":"https://github.com/bastianblokland/componenttask-unity","last_synced_at":"2025-10-24T19:30:29.021Z","repository":{"id":97603435,"uuid":"197943500","full_name":"BastianBlokland/componenttask-unity","owner":"BastianBlokland","description":"Library to run dotnet's 'Task' and 'Task\u003cT\u003e' scoped to Unity components.","archived":false,"fork":false,"pushed_at":"2019-11-26T17:13:18.000Z","size":701,"stargazers_count":21,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-23T11:31:48.709Z","etag":null,"topics":["task","unity-package-manager","unity3d","upm"],"latest_commit_sha":null,"homepage":"https://bastianblokland.github.io/componenttask-unity/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BastianBlokland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-07-20T14:47:01.000Z","updated_at":"2024-04-20T04:49:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"03ee4a36-7e78-400a-923e-da70e5d1411e","html_url":"https://github.com/BastianBlokland/componenttask-unity","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Fcomponenttask-unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Fcomponenttask-unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Fcomponenttask-unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Fcomponenttask-unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BastianBlokland","download_url":"https://codeload.github.com/BastianBlokland/componenttask-unity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867815,"owners_count":16554365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["task","unity-package-manager","unity3d","upm"],"created_at":"2024-09-24T13:23:09.217Z","updated_at":"2025-10-24T19:30:28.451Z","avatar_url":"https://github.com/BastianBlokland.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ComponentTask-Unity\n\n[![Tests](https://img.shields.io/azure-devops/tests/bastian-blokland/ComponentTask/6/master.svg)](https://dev.azure.com/bastian-blokland/ComponentTask/_build/latest?definitionId=6\u0026branchName=master)\n[![GitHub release](https://img.shields.io/github/release/BastianBlokland/componenttask-unity.svg)](https://github.com/BastianBlokland/componenttask-unity/releases/)\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n\nUnity package for running dotnet `Task` and `Task\u003cT\u003e` scoped to Unity components.\n\n\n### Description\nCommon problem with using c# `async` methods in Unity is that they have no concept of a component\nlife-time.\nSo unlike [Coroutines](https://docs.unity3d.com/ScriptReference/Coroutine.html) when you 'start' a\ntask and then destroy the component (by loading a new scene for example) the task does not stop.\nMost of the time leading to `UnityEngine.MissingReferenceException` when you try to access members\nof the component after it has been destroyed on the Unity side. And as a workaround you have to\nwrite ugly '`if (!this) return;`' guards after every await.\n\nThis library aims to fix that problem by allowing you to run tasks 'on' your `MonoBehaviour` with very\nsimilar behaviour as Unity's `Coroutines`.\n\n\n### Usage\n```c#\nusing System.Threading.Tasks;\nusing UnityEngine;\n\nclass MyClass : MonoBehaviour\n{\n    void Start()\n    {\n        this.StartTask(RunAsync);\n    }\n\n    async Task RunAsync()\n    {\n        while (true)\n        {\n            Debug.Log(\"Running...\");\n            await Task.Yield();\n        }\n    }\n}\n```\nThis example will print `Running...` every frame when the component is enabled and will stop when\nthe component gets destroyed.\n\n[More examples](https://bastianblokland.github.io/componenttask-unity/examples.html)\n\n\n### Documentation\n* [Install](https://bastianblokland.github.io/componenttask-unity/install.html)\n* [How To](https://bastianblokland.github.io/componenttask-unity/how-to.html)\n* [Examples](https://bastianblokland.github.io/componenttask-unity/examples.html)\n* [Api Reference](https://bastianblokland.github.io/componenttask-unity/api/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastianblokland%2Fcomponenttask-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastianblokland%2Fcomponenttask-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastianblokland%2Fcomponenttask-unity/lists"}