Dispatcher


Main thread dispatcher script.

Dispatcher’s main purpose is to dispatch actions< ...


by Vadim Andriyanov


★★★★★ star rating
Price History +

Main thread dispatcher script.
Dispatcher's main purpose is to dispatch actions from background thread to main thread.

Usage:
1) Add Empty GameObject to Scene
2) Add Component -> Dispatcher
3) Write code in background thread function:

Dispatcher.Current.BeginInvoke(() =>
{
  Output.text += param;
  Output.text += Environment.NewLine;
});

Action will be executed on main thread.
Complete demo script in DispatcherTest.cs