- Home /
Question by
Sorade · Sep 29, 2017 at 01:46 PM ·
eventdelegateexecution orderevent-listener
Will UnityEvent wait for completion of listeners ?
Hi all,
I am using the UnityEvent EventManager script from this post in one of my games.
I want to know if Unity waits for all the listeners to finish their function before moving on to the next line ?
For example,
If I have a method somewhere in my code that contains:
EventManager.Invoke("MyFirstEvent");
EventManager.Invoke("MySecondEvent");
Will MySecondEvent be invoked only after all the listeners of MyFirstEvent have finished ?
The reason being that I perform an operation in one of the listeners of MyFirstEvent which is needed for an operation performed in MySecondEvent.
Alternatively am I best to use a coroutine and call the MyFirstEvent on the first frame and MySecondEvent on the following one just to be sure.
Thanks
Comment