9-13 FixedUpdates per frame

I have a problem where at some frames, about every 5s my FixedUpdate is called 9 or even 13 times in one frame, and I dont even have low framrate or anything. It just randomly calls it 9 times, which of course results in a lag but there is nothing else that causes a lag. In deep profiling mode with a lot of stuff turned of my game takes 5ms per frame but with this it spikes up to 11ms which causes a bad lag. Its really weird because this only happens when my Player is moving on my procededural generated Terrain. Yesterday I changed a calculation of a fallofmap with an array of the size 20000x20000 to use UnityEnige.mathemtics “half” instead of “float” so my memory would be better but apperently this somehow leads to this bug. I though certaily this couldt have caused this FixedUpdate bug but appently it did. Any thoughts on this and why this could happen and how this might be fixable?

9333491--1306064--12xFixedUpdate.png

FixedUpdate is not driven by physics, physics is not in control of it. It’s a standard call by the Playerloop. It calls the scripts, animation, physics etc.

I’ll move your post to the correct forum.

Check the frame immediately before this happens. if you have an unrelated slow frame before this one, it will cause FixedUpdate to have to run many times to catch up. It’s possible your switch from float to half incurred a significant performance penalty.

Are you computing 400 MILLION things every frame?

Or is that just on one frame?

If it’s just one frame, then as Praetor notes it will choke up the framerate for a moment, give you a bunch of dupe catchup calls.

Its just calcultated on one frame on Awake. So it only happens on start up. The thing I changed is replace all “float” with “half” and that apperently caused this. And I dont think its has anything to do with catchup, because these 12 FixedUpdate calls happen constaly also way after I run the script and only happen like every 5s because this behaviour woudnt make sense then right?, so I cant imagine that this is catchup though it might be possible that its causes some bug so that the FixedUpdate thinks it needs to catch up.

But I think you were right about the performence. My game took way longer to start, probalby because of the half, but why would half be slower shouldt it be just as fast? Or is it some Compiler issue where it cant optimise stuff because it doesnt know half?