Dispatcher #
A call queue processing component for interaction with the main Unity thread.
Definition #
Namespace: VRRSS.SDK.Threading
Type: Class
Inheritance: MonoBehaviour
Provides a call queue for interaction with the main Unity thread.
public class Dispatcher : MonoBehaviour
Properties #
InvokeRequired #
Type: bool
Access: get;
Description: Returns a value indicating whether the calling object should invoke the Invoke method during action calls, since the calling object is not on the main Unity thread.
public static bool InvokeRequired { get; }
Methods #
Invoke #
Description: Adds an action to the queue for execution on the main Unity thread.
public static void Invoke(Action action)
Parameters #
action #
Type: Action
Description: The action to be executed on the main thread.
Example usage #
if (Dispatcher.InvokeRequired)
{
Dispatcher.Invoke(() =>
{
Debug.Log("Quit");
Application.Quit();
});
}
else
{
Debug.Log("Quit");
Application.Quit();
}