If there is one thing that is guaranteed to drain the blood from the face of Unity Developer it’s a tight loop. If you introduce a tight loop into your code then chances are you’re going to have to kill the Unity Editor (tip: sometimes you can escape them by deliberately introducing an exception in the loop’s code while running).
One way to mitigate this risk is put any dangerous code into a Coroutine with at least one yield inside the loop.
This can give Unity the opportunity to stop the code. However, if you’re writing a Unity Editor, StartCoroutine is part of the MonoBehaviour not the Editor - these are actually ScriptableObjects.read more