Hey, when I am playing my game I sometimes get some pretty hard framerate drops, sometimes from a steady 80 - 90 fps to below 20. I don’t know why, they appear randomly and never at specific moments (for example sometimes when the player is just walking, other times when the player is shooting or interacting). They don’t occur incredibly often but often enough to notice. I am not sure if this is cause of my laptop or another factor within the game. Any ideas why this could be?
Okay so I am not 100% sure on a perfect answer, but I noticed a lot of the lag was reduced after some tweaking, especially when I am not running the game in Unity but when actually running the build, the framerate is pretty steady. Here are the two factors that I think effected it the most:
- Add some fan cooling to my Laptop
- Use less static scripts and replace them with “GetComponent” as its faster and requires less CPU
If you have anything else that might help be sure to comment it, I hope this can help some other people who are experiencing similar issues.
I totally know the answer to your problem. Frame rate depends on these occasions:
To many objects or you have used terrain
Graphics quality is too high
you did not set the expected frame rate code:
function Awake () {
// Make the game run as fast as possible in Windows
Application.targetFrameRate = 300;
}
note: you can set the frame rate to any number if you want.
networking being used
computer is hot and needs cooling ASAP
need bigger RAM
Or, you computer is just slow
These answers are %100 tested and works. This may help you get the speed of the game you want it to go. Or it might just kill you computer(Overwork it).
I had frame rate drop when coding for a mobile device. My solution was to modify The Camera Rendering Path to Legacy Vertex Lit which made a whole 30fps difference.
Man I have The Same Problem but nothing seems to help, My Game runs smoothly but then suddenly it goes to 0 fps. Can Anyone help?