Pause editor execution while game runs

The thread title doesn’t quite describe the situation I have, but it’s close. I have an EditorWindow which calls a piece of code. This code starts the game playing using

EditorApplication.isPlaying = true;

The problem is that I need this code to then wait while the game plays for a bit, and resume in X seconds time, or when a signal is given. Coroutines won’t work because they seem to only work in MonoBehaviours that are in-game. I need another way of telling this code to wait, without blocking the main game from updating and executing.

I don’t know the interactions between the Unity process that runs the editor and the process that runs the game. I don’t know how threads work (I’ve been told there is only one Unity thread) - but I really desperately need this functionality. Does anyone know how to yield or wait or sleep or pause execution of a codeblock while still allowing the main game to continue executing and updating?

Thanks!

Each EditorWindow is updated (100 times per second, according to the documentation) so you could define an Update function and run a simple timer inside it.

Best regards,
Peter.