
The Dispatcher class helps run actions on the main thread in Unity. It queues actions from background threads and executes them during the Update.The Dispatcher class helps run actions on the main thread in Unity. It queues actions from background threads and executes them during the Update. It also limits the time spent on each action to keep the frame rate smooth. 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; }); The action will be executed on the main thread.Complete the demo script in DispatcherTest.cs.