Haply::Inverse::Unity::EventDispatcher
A thread-safe class which holds a queue with actions to execute on the next Update() method. More...
Inherits from Haply.Inverse.Unity.Singleton< EventDispatcher >, MonoBehaviour
Public Functions
Name | |
---|---|
void | Awake() |
void | Update() |
void | Enqueue(IEnumerator action) Locks the queue and adds the IEnumerator to the queue. |
void | Enqueue(Action action) Locks the queue and adds the Action to the queue. |
void | Enqueue(UnityEvent action) Locks the queue and adds the Action to the queue. |
void | Enqueue< T >(Action< T > action, T arg) Locks the queue and adds the Action (with a parameter T) to the queue. |
void | Enqueue< T >(UnityEvent< T > action, T arg) Locks the queue and adds the Action (with a parameter T) to the queue. |
void | Enqueue< T0, T1 >(Action< T0, T1 > action, T0 arg0, T1 arg1) Locks the queue and adds the Action (with two parameters T0 and T1) to the queue. |
void | Enqueue< T0, T1 >(UnityEvent< T0, T1 > action, T0 arg0, T1 arg1) Locks the queue and adds the Action (with two parameters T0 and T1) to the queue. |
Task | EnqueueAsync(Action action) Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes. |
Task | EnqueueAsync(UnityEvent action) Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes. |
Task | EnqueueAsync< T >(Action< T > action, T arg) Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes. |
Task | EnqueueAsync< T >(UnityEvent< T > action, T arg) Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes. |
Public Properties
Name | |
---|---|
bool | IsMainThread |
Additional inherited members
Public Functions inherited from Haply.Inverse.Unity.Singleton< EventDispatcher >
Name | |
---|---|
void | InitializeInstance() Initializes the singleton instance. |
bool | Exists() |
Protected Functions inherited from Haply.Inverse.Unity.Singleton< EventDispatcher >
Name | |
---|---|
virtual void | OnDestroy() |
virtual void | OnApplicationQuit() |
Public Properties inherited from Haply.Inverse.Unity.Singleton< EventDispatcher >
Name | |
---|---|
T | Instance Gets the instance of the singleton class. |
Detailed Description
class Haply::Inverse::Unity::EventDispatcher;
A thread-safe class which holds a queue with actions to execute on the next Update() method.
It can be used to make calls to the main thread for things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling
Public Functions Documentation
function Awake
void Awake()
function Update
void Update()
function Enqueue
void Enqueue(
IEnumerator action
)
Locks the queue and adds the IEnumerator to the queue.
Parameters:
- action IEnumerator function that will be executed from the main thread.
function Enqueue
void Enqueue(
Action action
)
Locks the queue and adds the Action to the queue.
Parameters:
- action function that will be executed from the main thread.
function Enqueue
void Enqueue(
UnityEvent action
)
Locks the queue and adds the Action to the queue.
Parameters:
- action function that will be executed from the main thread.
function Enqueue< T >
void Enqueue< T >(
Action< T > action,
T arg
)
Locks the queue and adds the Action (with a parameter T) to the queue.
Parameters:
- action function (requires parameter of type T) that will be executed from the main thread.
- arg parameter of type T to pass to action.
function Enqueue< T >
void Enqueue< T >(
UnityEvent< T > action,
T arg
)
Locks the queue and adds the Action (with a parameter T) to the queue.
Parameters:
- action function (requires parameter of type T) that will be executed from the main thread.
- arg parameter of type T to pass to action.
function Enqueue< T0, T1 >
void Enqueue< T0, T1 >(
Action< T0, T1 > action,
T0 arg0,
T1 arg1
)
Locks the queue and adds the Action (with two parameters T0 and T1) to the queue.
Parameters:
- action function (requires parameters of type T0 and T1) that will be executed from the main thread.
- arg0 parameter of type T0 to pass to action.
- arg1 parameter of type T1 to pass to action.
function Enqueue< T0, T1 >
void Enqueue< T0, T1 >(
UnityEvent< T0, T1 > action,
T0 arg0,
T1 arg1
)
Locks the queue and adds the Action (with two parameters T0 and T1) to the queue.
Parameters:
- action function (requires parameters of type T0 and T1) that will be executed from the main thread.
- arg0 parameter of type T0 to pass to action.
- arg1 parameter of type T1 to pass to action.
function EnqueueAsync
Task EnqueueAsync(
Action action
)
Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes.
Parameters:
- action function that will be executed from the main thread.
Return: A Task that can be awaited until the action completes
function EnqueueAsync
Task EnqueueAsync(
UnityEvent action
)
Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes.
Parameters:
- action function that will be executed from the main thread.
Return: A Task that can be awaited until the action completes
function EnqueueAsync< T >
Task EnqueueAsync< T >(
Action< T > action,
T arg
)
Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes.
Parameters:
- action function that will be executed from the main thread.
- arg parameter of type T to pass to action.
Return: A Task that can be awaited until the action completes
function EnqueueAsync< T >
Task EnqueueAsync< T >(
UnityEvent< T > action,
T arg
)
Locks the queue and adds the Action to the queue, returning a Task which is completed when the action completes.
Parameters:
- action function that will be executed from the main thread.
- arg parameter of type T to pass to action.
Return: A Task that can be awaited until the action completes
Public Property Documentation
property IsMainThread
static bool IsMainThread;