docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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:

    • System.Threading.Tasks.Task
    • System.Threading.Tasks.Task<TResult>

    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 await expressions, including with Unity's Awaitable class.
    • As the return type for async methods.
    • With Unity coroutines.

    Additional resources

    • Call asynchronous methods
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)