- Home /
Everything in Unity starts and stops, starts and stops, on and on..
I thought it was all because I had a bunch of warnings in my error console, but I debugged everything with zero errors or anything, and this freezing keeps happening on and off repeatedly (always a consistent frequency, but different every time the error starts happening). This has also happened on my laptop when I did use it. Back then, I didn't have nearly as much code running.
The computer I use now is a beast and it's very hard to slow it down. All my hardware is very new and up to date and can run most games on highest graphics.. I'm running windows 7 64 bit. My laptop used vista 64-bit.
The only solution I have found is closing and reopening Unity. (same on my laptop)
I also have thee latest version running.
Any idea what this might be, or how I can solve it?
I have the pro version, so I can check the profiler, but I'm not even sure what to look for.
Ps: I have never seen this happen in a compiled project.
Without some more information, its impossible to tell what is causing this...
It's not unusual for scripting to cause the game to bog down... Unity updates many times a second, if you make the computer do something that takes more than say, 1/60th of a second, there will be some lag.
If you have a LOT of objects that have Update() functions on them, just the sheer pile of commands co$$anonymous$$g in all at one time can cause a problem.
Look up Co-Routines and the yield statement.
So, your saying to optimize the code more? I have actually been coding for some time, and I can usually tell when there's something really inefficient happening in my code.
For instance, I designed this spark system that would create more sparks when there are more collisions. A funny thing happened where a spark would fly and trigger this chain reaction of more sparks, and in a moment, there were so many sparks (with scripts going) all at once, Unity completely bogged down and lost framerate. That was framerate, not this weird freeze on and off thing.
Now, I'm sorry I forgot to mention, but get this: This freeze on and off thing happens in editor even when my game isn't playing. It isn't like a loss of fps because I know what that looks like. There is something weird happening in the editor and nowhere else, at least not in my compiled projects.
I did look into the yield thing, and I'd like to try it out sometime. What I currently like doing is splitting a load in half using if(time%2==0)
If it isn't happening while the game is running (in 'edit' mode), check the editor scripts (if you have any). I also sometimes run into this problem. I'm not sure what it is, but I think it might be a background process running.
Ok thanks! Is there a way to see what editor scripts are running?
I think this might have to do with the playup pluggin I have installed. $$anonymous$$aybe, just maybe..
I'm going to have to look into this.
Your answer
![](https://koobas.hobune.stream/wayback/20220613063507im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to turn on a light by pressing and after few seconds turn it off 1 Answer
How to make a light turn on/off 1 Answer
UI Button ON/Off 3 Answers
How can i make my Timer script start and pause only when something certain is activated? 2 Answers
particle emitter on/off using the left mouse button 1 Answer