C# Class UnityTools.Threading.UnityDispatcher

The UnityDispatcher class allows you to execute code on the main Unity thread. This is useful for situations where you need code on a seperate thread (i.e. slow IO operations) to access things that can only be accessed on the main thread.
Inheritance: UnityEngine.MonoBehaviour, IInitialiseOnStartup, IDispatcher
Afficher le fichier Open project: NoxHarmonium/unity-tools Class Usage Examples

Méthodes publiques

Méthode Description
Dispatch ( System.Action action ) : void

Dispatches the action asynchronously on the Unity main thread. The action will execute in the next frame update phase.

DispatchWait ( System.Action action ) : void

Dispatches the action asynchronously on the Unity main thread but blocks the current thread until the action is executed. The action will execute in the next frame update phase.

Initialise ( ) : void
PumpActionQueue ( ) : void

This method should be executed on the main dispatch thread to execute the queued dispatch actions.

Private Methods

Méthode Description
Awake ( ) : void
GetCurrentThreadId ( ) : int
Update ( ) : void

Method Details

Dispatch() public méthode

Dispatches the action asynchronously on the Unity main thread. The action will execute in the next frame update phase.
public Dispatch ( System.Action action ) : void
action System.Action The action to execute on the dispatch thread.
Résultat void

DispatchWait() public méthode

Dispatches the action asynchronously on the Unity main thread but blocks the current thread until the action is executed. The action will execute in the next frame update phase.
public DispatchWait ( System.Action action ) : void
action System.Action The action to execute on the dispatch thread.
Résultat void

Initialise() public méthode

public Initialise ( ) : void
Résultat void

PumpActionQueue() public méthode

This method should be executed on the main dispatch thread to execute the queued dispatch actions.
public PumpActionQueue ( ) : void
Résultat void