UnityFx.Async
Requires Unity 2018.3 or higher.
SUMMARY
Lightweight Task-like asynchronous operations (promises) for Unity3d.
Library is designed as a lightweight
Unity3d-compatible
Tasks alternative. Main design goals are:
- Minimum object size and number of allocations.
- Extensibility. The library entities are designed to be easily extensible.
- Thread-safe. The library classes can be safely used from different threads (unless explicitly stated otherwise).
-
Promises support. All asyncronous operations in library support promise-like programming.
-
Task-like interface and behaviour. In many cases library classes can be used much like corresponding
TPL entities.
-
Unity3d-specific features and compatibility. This includes possibility to
yield operations in coroutines,
net35-compilance, extensions of Unity asynchronous operations etc.
The table below summarizes differences berween
UnityFx.Async and other popular asynchronous operation frameworks:
| Stat | UnityFx.Async |
C-Sharp-Promise |
TPL |
| :--- | :---: | :---: | :---: |
| Thread-safe | ✔️ | - | ✔️ |
| .NET 3.5 compilance | ✔️ | ✔️ | - |
| Supports
SynchronizationContext capturing | ✔️ | - | ✔️ |
| Supports continuations | ✔️ | ✔️ | ✔️ |
| Supports Unity coroutines | ️✔️ | - | - |
| Supports
async / await | ✔️ | - | ✔️ |
| Supports
promise-like continuations | ✔️ | ✔️ | - |
| Supports cancellation | ✔️ | - | ✔️ |
| Supports progress reporting | ✔️ | ✔️ | ✔️ |
| Supports child operations | - | - | ✔️ |
| Supports
Task-like types (requires C# 7.2) | ✔️ | - | ✔️ |
| Supports
ExecutionContext flow | - | - | ✔️ |
| Minimum allocations per continuation | ~1 | 5+ | 2+ |
NOTE: As the table states
ExecutionContext flow is NOT supported. Please use
Tasks if you need it.
USAGE
Npm package is available at
npmjs.com. To use it, add the following line to dependencies section of your
manifest.json. Unity should download and link the package automatically:
``
json
{
"scopedRegistries": [
{
"name": "Arvtesh",
"url": "https://registry.npmjs.org/",
"scopes": [
"com.unityfx"
]
}
],
"dependencies": {
"com.unityfx.async": "1.1.0"
}
}
``
USEFUL LINKS
*
Github project
*
NuGet package
*
Npm package
*
AppVeyor
*
Unity Asset Store
*
Unity Forums
*
Documentation
*
License
*
Support