docs.unity3d.com
    Show / Hide Table of Contents

    Class TaskSchedulerWebGL

    Provides the means to schedule tasks on a background thread or the main thread. Also allows for creation of co-routines from classes that do not inherit from MonoBehaviour.

    This is thread safe, through it must be constructed on the main thread.

    Inheritance
    Object
    TaskScheduler
    TaskSchedulerWebGL
    Inherited Members
    TaskScheduler.ScheduleOrExecuteOnMain(Action)
    Namespace: Unity.GameBackend.CloudCode.Scheduler
    Syntax
    public sealed class TaskSchedulerWebGL : TaskScheduler

    Methods

    IsMainThread()

    Determines whether the current thread is the main thread. WebGL currently runs on a single thread, so this will always be false.

    Declaration
    public override bool IsMainThread()
    Returns
    Type Description
    Boolean

    Whether or not this thread is the main thread.

    Overrides
    TaskScheduler.IsMainThread()

    ScheduleBackgroundTask(Action)

    Schedules a new task on a background thread. NOTE: In WebGL, multi-threading isn't supported, so this will be scheduled on main thread instead.

    Declaration
    public override void ScheduleBackgroundTask(Action task)
    Parameters
    Type Name Description
    Action task

    The task that should be executed on a background thread.

    Overrides
    TaskScheduler.ScheduleBackgroundTask(Action)

    ScheduleMainThreadTask(Action)

    Schedules a new task on the main thread. The task will be executed during the next update.

    Declaration
    public override void ScheduleMainThreadTask(Action task)
    Parameters
    Type Name Description
    Action task

    The task that should be executed on the main thread.

    Overrides
    TaskScheduler.ScheduleMainThreadTask(Action)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023