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()
ExecuteQueue(IAssetLoaderContext)
Executes the actions in the given queue and waits for its execution, handling the async and sync calls automatically.
Declaration
public static void ExecuteQueue(IAssetLoaderContext assetLoaderContext)
Parameters
Type | Name | Description |
---|---|---|
IAssetLoaderContext | assetLoaderContext | The Asset Loader Context reference. Asset Loader Context contains the Model loading data. |
ExecuteRecursively(IEnumerator)
Executes the given enumerator recursively.
Declaration
public static void ExecuteRecursively(IEnumerator enumerator)
Parameters
Type | Name | Description |
---|---|---|
IEnumerator | enumerator | The enumerator to execute. |
InvokeAsync(Action)
Queues an action to be invoked on the Main Thread.
Declaration
public static void InvokeAsync(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | The Action to be queued on the Main Thread. |
InvokeAsyncAndWait<T>(Action<T>, T)
Queues an action to be invoked on the Main Thread and waits for its execution, handling the async and sync calls automatically.
Declaration
public static void InvokeAsyncAndWait<T>(Action<T> action, T context) where T : class, IAwaitable, 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. |
Type Parameters
Name | Description |
---|---|
T |
InvokeAsyncUnchecked<T>(Action<T>, T)
Queues an action to be invoked on the Main Thread.
Declaration
public static void InvokeAsyncUnchecked<T>(Action<T> action, T context)
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. |
Type Parameters
Name | Description |
---|---|
T |
InvokeAsync<T>(Action<T>, T)
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) 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. |
Type Parameters
Name | Description |
---|---|
T |