Task for Unity (Threading)
Xefier
$17.59
Date |
Price |
---|---|
日時 |
価格($) |
03/17(2018) |
17.59 |
11/24(2024) |
17.59 |
Jump AssetStore
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.Result
Task 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