Camera suddently starts to lag with no obvious reason

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Idleman

I am not sure what caused the problem, but my game suddenly starts to lag. It is very hard to understand, I did not changed any setting and it was fine a minute ago. Then it starts to lag. Since that, it always lags, it is like every a few frames there is a frame missing and the result is moving object is lagged randomly.

I did my research, and think that might be a result of camera no align with the player. I tried different things. Some times by adding a script to the camera with align() in the process could solve the issue. However, even with the script, it still happen from time to time.

When I open a earlier version of the game, it did not have the problem(so it is not a hardware related issue), but I didn’t make any noticeable changes. Now I am not sure if I should keep going with the current state of unpredictable lagging or switch to the earlier version and build on that. Has anyone encounter this kind of camera lagging before? Thank you.

:bust_in_silhouette: Reply From: Idleman

After playing around and tried different things, I found the solution to fix the issue. It is really weird problem, turns out in the editor, if I zoom-in close to the camera resolution and run the game. The FPS is quite stable at 60 and no lagging problem. If I zoom-out far from the camera resolution, then run the game. The FPS is jumping from 57~63 and lagging is on.

I have no idea why that is, or what is the technical behind it, but it did get the problem fixed. If any one could share some insights about this issue will be really great.