- Home /
force quitting
i sometimes find myself in a situation where everything freezes because i forgot to code something to make a certain loop stop, result ing in sometimes spawning billions of objects accidentally.
the only way out is to force quit.
can this have dramatic effects on files, textures, scripts, materials, models, ect?
Im not entirely sure, but I dont think so. when you accidentally do the loop, you're in-game, right?
Well.. I've done it before while working on a respawn system... It didnt destroy/damage any of my files :) I would avoid it though :)
thank you! I've done it many times, so i don't think it can damage anything, and I'm sure it didn't damage anything now. i am going to avoid it using this simple script (ill post below) i made using the Debug.Break i got to know from UFO Hunter
Answer by code-blep · Aug 21, 2012 at 01:15 PM
This post may help you Cheesley.
http://answers.unity3d.com/questions/26670/can-i-force-game-execution-to-stop-in-the-editor.html
thank you, but since i already force quit a few times, can that still have effects on files?
I have had to force quit a few times of late. As yet I personally have not experienced any issues doing this. That said though it's not great for any application to be closed that way.
Regular backups of the entire project is the key if you keep experiencing problems that require you to kill an application.
Answer by Chesley · Aug 21, 2012 at 01:34 PM
the script i now use to avoid this:
function Update() {
var fps = 1.0f / Time.deltaTime;
if(fps < 5) {
Debug.Break();
}
}
Nice. I might add that to my list of handy code. Is it tried and tested? I only ask is that if Unity is running V slow and maybe unresponsive, does this script really work. I demand you go break you project to test ;)
sorry just saw you commented (little late), yes i tested it, but i should change the 5 to a 2 or a 1 since it then only pauses on major cpu spikes ins$$anonymous$$d of regular pauses
Your answer
![](https://koobas.hobune.stream/wayback/20220613075954im_/https://answers.unity.com/themes/thub/images/avi.jpg)