Threading and Application.isPlaying

So I’m in the editor and I think my threads (which I’m stuck with) are still running even after I hit the stop button.

I’d like to do something like this:

#if UNITY_EDITOR
    if (!Application.isPlaying) StopEverything();
#endif

but that Unity interface is only allowed on the “main thread”.

So -

a) Am I imagining that the threads still run? I’ve been pretty convinced at times, and largely am just frustrated by slowness and crashes when working in the editor. But I’ve not read definitively that the Editor can’t deal with shutting down threads that user code has started and would love for someone to (accurately) tell me I’m wrong about that.

b) Given I’m right about that, how do I have these threads shutdown gracefully on their own? If I count on something in the main thread to provide a trigger (OnApplicationQuit() or whatever), I don’t feel like I can rely on that since, obviously, I’m debugging code and I can easily mess up something that isn’t dead simple.

And if it’s relevant, I’m stuck with 3.5 for the time being.

Here is what I usually do, when I need to stop my threads.

• Add a bool to my threads loop.
• When I abort my thread, I set the bool to false and check if its aborted properly.

Then you can from some sort of manager script stop the threads from the main thread.

Here is a guide that explains the idea in depth: