I have been going nuts over this and figured I should just ask if this is normal or if anyone has advice on it. I have a very basic little room with a FPC moving around with some custom scripts and whatnot. Nothing major at all. I have an Nvidia 9600 GT. I play other games on this machine and experience no weird oddities like I do when running my own unity stuff at full resolution.
The FPS is usually between 50-130 or so yet there are these sudden performance lags visually. I also hear my hard drive spinning faster when it happens. I checked for malware firstly and disabled any services that were pointless. I watch the vista performance monitor and the cpu useage stays around 7.00%… ram useage is somewhere around 100,000k. I tested this as an exe and the same problem is there. I reduced the game code down to the bare minimum and even removed textures and the same thing happens.
I also noticed that when I started the .exe suddenly a bunch of extra windows services kicked into gear like superfetch stuff.
Any idea what could be causing this?
My camera is fine and walking is fine then it happens every few moments especially when moving and its like it jumps a few “frames” to a new location after the camera and movement locks for a split second.
I tried changing the mouselook and FPC scripts to run on update…fixedupdate…lateupdate…always the same issue.
Anyone have any idea what this could be? Because it is making me want to smash things in here lol.
This may be the result of the garbage collector being called every now and again. Do you have any scripts that allocate a lot of objects or strings? There are a few GC-killing algorithms that can cause this behaviour. For example, building a string by concatenating many short strings on the end may seem innocent but has terrible GC behaviour.
Thank you! It is very good to know because I did have two separate scripts that were updating every frame and printing the results of two different raytraces. Each one had been concatenating two variables for the print. I turned them both off since they were for debugging/testing anyway but it didn’t help the problem much if at all.
So I started breaking down everything more and more. I noticed that it was not the scripts that were lagging it much if at all.
Because I figured the physics were run in software by the cpu and not video I checked the cpu the other day and noticed no spikes with physics or anything so I ignored it… However, today I removed some physic objects that I happened to have at nonstop rest and/or forces applied. It fixed it!!! Finally! It was my physics causing the issue all along.
So to help keep this at bay I reduced my physics solver iteration value from 25 down to 5. The physics look a tad “fake” but I will bump them up depending on content later on.
Now I can get back to having some fun after all this time!
I wonder why the physics causing this would not reflect that in the cpu process readout?