Publisher | Xefier |
---|---|
File size | 249.72kB |
Number of files | 7 |
Latest version | 1 |
Latest release date | 2017-11-27 05:58:35 |
First release date | 2017-03-23 06:38:24 |
Supported Unity versions | 2018.4.2 or higher |
Task for Unity makes threads easier!
Documentation
Forum
Changes
- Improved Async Scheduler integration
What is Task for Unity?
- Provides a simple way to manage threads
- Unlocks the power of multi-thread CPUs
Why is Task for Unity useful?
If you have long running thread-safe operations you can optimize your game by putting them on a separate thread without writing complex thread management code.
Features
Task.Run()
Runs work on separate thread (pool)
Task.ContinueWith()
Run work asynchronously when Task completes
Task<T>.Result
Task<T> performs same operations as Task except it has a Result where T = any type (int, float, etc)
Task.Exception
Gets exception from thread. Exceptions are usually tricky to handle in separate threads but Task.Exception provides an easy way to handle them!
Status
Check task's status with:
- Status
- IsCanceled
- IsCompleted
- IsFaulted (Exception)
Task.WhenAll
Creates a task that completes when all specified tasks are complete
Task.WhenAny
Creates a task that completes when any specified tasks are complete
Task.Wait()
Waits for Task to complete
Task.WaitAll()
Waits for all specified tasks to complete
Task.WaitAny()
Waits for any specified tasks to complete
Thread Pool
Thread pools are important to avoid the cost of creating a new thread. But Task manages this so you don't have to!
Want to run code on main, or spawn objects on a thread?
Async Scheduler
Want to run for loops in Parallel?
Parallel for Unity
Documentation
Forum
Changes
- Improved Async Scheduler integration
What is Task for Unity?
- Provides a simple way to manage threads
- Unlocks the power of multi-thread CPUs
Why is Task for Unity useful?
If you have long running thread-safe operations you can optimize your game by putting them on a separate thread without writing complex thread management code.
Features
Task.Run()
Runs work on separate thread (pool)
Task.ContinueWith()
Run work asynchronously when Task completes
Task<T>.Result
Task<T> performs same operations as Task except it has a Result where T = any type (int, float, etc)
Task.Exception
Gets exception from thread. Exceptions are usually tricky to handle in separate threads but Task.Exception provides an easy way to handle them!
Status
Check task's status with:
- Status
- IsCanceled
- IsCompleted
- IsFaulted (Exception)
Task.WhenAll
Creates a task that completes when all specified tasks are complete
Task.WhenAny
Creates a task that completes when any specified tasks are complete
Task.Wait()
Waits for Task to complete
Task.WaitAll()
Waits for all specified tasks to complete
Task.WaitAny()
Waits for any specified tasks to complete
Thread Pool
Thread pools are important to avoid the cost of creating a new thread. But Task manages this so you don't have to!
Want to run code on main, or spawn objects on a thread?
Async Scheduler
Want to run for loops in Parallel?
Parallel for Unity