Main Thread Task
Task/UniTask-based Main Thread dispatcher, no GameObjects involved
com.gilzoide.main-thread-task Unity Compatibility
Unity 6 Supported
2023.2 Supported
2023.1 Supported
2022.3 LTS Supported
2021.3 LTS Supported
2020.3 LTS Not tested
2019.4 LTS Not tested
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/main-thread-task.git 
README Markdown
Copy this to your project's README.md
## Installation
Add **Main Thread Task** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/main-thread-task.git
```
[](https://www.pkglnk.dev/pkg/main-thread-task)README
Main Thread Task
Task/UniTask-based
Main Thread dispatcher classes, no GameObjects involved.
Features
- Simple to use: call
MainThreadTask.Runand that's it, your action will run on the Main Thread! asyncmethodMainThreadTask.RunAsync, so you canawaitfor execution to complete- TaskScheduler and TaskFactory used for running Tasks on the Main Thread are available
- UniTask-based implementation in
MainThreadUniTaskclass, conditionally compiled if UniTask is detected in project System.Actionextension methodsInvokeOnMainThreadandInvokeOnMainThreadAsync- No
GameObjects involved - Simple implementations with around 50 lines of code each
How to install
Either:
- Install via Unity Package Manager using the following URL:
https://github.com/gilzoide/unity-main-thread-task.git#1.0.0
Copy the implementation file Runtime/MainThreadTask.cs and/or Runtime/MainThreadUniTask.cs to your project.
If using UniTask, either remove the
#if/#endiflines fromMainThreadUniTask.csor defineHAVE_UNITASKin your project's scripting define symbols.
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In