Class Dispatcher
Represents a system for dispatching Actions to execute on the Main Thread.
Namespace: TriLibCore.Utils
Assembly: TriLibCore.dll
Syntax
public class Dispatcher : MonoBehaviour
Constructors
Dispatcher()
Declaration
public Dispatcher()
Properties
DontDestroyOnLoad
Gets/Sets whether the Dispatcher instance will be destroyed when a new level is loaded.
Declaration
public static bool DontDestroyOnLoad { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CheckInstance()
Ensures a Dispatcher instance exists.
Declaration
public static void CheckInstance()
InvokeAsync(Action, bool)
Queues an action to be invoked on the Main Thread.
Declaration
public static void InvokeAsync(Action action, bool async = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | action | The Action to be queued on the Main Thread. |
| bool | async |
InvokeAsyncUnchecked<T>(Action<T>, T, bool)
Queues an action to be invoked on the Main Thread.
Declaration
public static void InvokeAsyncUnchecked<T>(Action<T> action, T context, bool async = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<T> | action | The Action to be queued on the Main Thread. |
| T | context | The Context to be assigned to the Action. |
| bool | async |
Type Parameters
| Name | Description |
|---|---|
| T |
InvokeAsync<T>(Action<T>, T, bool)
Queues an action to be invoked on the Main Thread, handling the async and sync calls automatically.
Declaration
public static void InvokeAsync<T>(Action<T> action, T context, bool async = true) where T : IAssetLoaderContext
Parameters
| Type | Name | Description |
|---|---|---|
| Action<T> | action | The Action to be queued on the Main Thread. |
| T | context | The Context to be assigned to the Action. |
| bool | async |
Type Parameters
| Name | Description |
|---|---|
| T |