How to make the unity editor respond while a script is working?

when i have a heavy script it hangs up the whole unity editor.

Lets say i just write while(True) in a script then i start the script and the editor will never respond again i cannot just stop the script how can i make sure this does not happen?

I would like a way to do this from the editor side i like to avoid to create constructions in the script that make it more complex or less compatible.

This is not a trivial thing to do, but recently there was a blog post about it: Unity Blog

Other than that there is no real way to stop an infinite loop other than quitting Unity or quitting the Unity process via the Task Manager or similar.

You should be saving your scene every time before you hit play anyway. Also I don’t think that infinite loops are a common problem. It’s only annoying if it happens and you forgot to save.

You can limit a while loop with a Sentinel variable:

var tries = 100;

while (true || tries-- > 0)
     //loop here