WebTask and WebTask<T>
Use the custom objects WebTask and WebTask<T> to handle asynchronous calls to the Facebook Instant Games SDK in a single-threaded environment.
Promises in the Instant Games SDK
Many endpoints in the Instant Games JavaScript SDK are asynchronous and return Promises that may or may not contain a value.
The closest equivalents to Promises in C# are:
Because Unity’s Web platform is a single-threaded environment, it doesn’t support these classes.
WebTask and WebTask<T>
This package provides WebTask and WebTask<T>, partial replacements for Task and Task<TResult> for a single-threaded environment.
You can use WebTask and WebTask<T> as follows:
- In
awaitexpressions, including with Unity'sAwaitableclass. - As the return type for
asyncmethods. - With Unity coroutines.