My framerate is good, at 40 - 80 fps, but once in a while it drops down to 3 - 5 fps, for no apparant reason. It is not caused by errors, etc., and my stats seem okay.
[3739-graphics+chop.png|3739]
So I can’t understand what’s wrong with it. Anyone have an idea?
The Unity Editor sometimes, very intermittently, get pauses and stutters during a run, just for being the Editor. It’s keeping extra stats, running the Inspector and Hierachy windows … . I’ve run the exact same stuttering projects in a real Build and had it all go away (then come back in the Editor again.)
The worst thing you can do is to have a Debug.Log (or print) statement in Update. It will kill your framerate. Are you sure you don’t spam Debug.Logs? In a build Debug.Logs in Update aren’t that bad, but keep in mind they get written to the log file. When one log has about 500 bytes and you run at 60 fps, that’s a lot per minute (~1.5MB / min)
I know some games that create huge logs when you play for a while. In my opinion that’s not an acceptable behaviour
Figured out the problem. I had five large objects rotating to face the camera using a script called LookAt2D.js, which does the turning in a fixedUpdate. Somehow, this caused the stated behaviour.