void Awake() { if (_singleton != null) { Debug.LogWarning("Multiple MainThread InvokePumps were added to the scene."); Object.Destroy(this); return; } _pump = new InvokePump(); //it was created in the main thread, so the owner thread is main thread _singleton = this; }
/// <summary> /// Blocking call that creates a new pump object and pumps /// driver invokes until stopped via a PopInvoker call. /// </summary> public void PushInvoker() { InvokePump newPump = new InvokePump(); _invokePumpStack.Push(newPump); // Blocking call while new driver invocations are handled on // new pump. newPump.Start(); }