Game slows down when no input is given.
Hello, I am making a very simple game that always runs smoothly at about 58-60 fps on a Galaxy J5 (low-medium range phone) but it seems to be lagging on my LG G2 (medium-high range phone) ONLY WHEN I DO NOT GIVE IT ANY TOUCH INPUT. No method is called when I single tap the screen but as long as I keep tapping the game runs smoothly at 59-60 fps, but when I no longer tap(or swipe or hold) the game goes at 45-50 fps. The game runs always smoothly in the editor. Any ideas about this?
is there any Debug.Log("") present? How do you catch the input?
I have a separate script on the player that controls the phase of each touch and its coordinates and calls a method on the player. As I said no method on the player is called when I tap the screen but it removes the lag. Is Debug.Log() a problem?
if you spam Debug.Log() messages on update this will easily crush app performance. Try to use Profiler and see where is problem(calls/self$$anonymous$$S);
Well there is no Debug.Log() in any update so I don't think that's the problem. Could it be something related to synchronization (vsync) or target frame-rate? I have an Application.targetFrameRate = 60 in the start function.
@hexagonius I've been trying to do that all day long but the profiler just stops after a couple of frames and makes the game much much slower (10-15) fps. Deleting the Application.targetFrameRate=60 partially solved the problem but it's definitely still there.
if the profiler cannot help you and the game gets unpredictably slow, cutting your content in half and seeing if that solves the problem, then adding up a quarter etc. could be a solution.
Nope it doesn't solve it. As I said the game runs very good on a low-end phone but still struggles on my LG. I can still play games like GTA or Formula1 on itso I don't think it's a phone performance problem...
I referred to code reduction if that's possible. disabling gameobjects etc. ruining less code, or maybe nothing at all to see if it's graphics hitting you.
Your answer
Follow this Question
Related Questions
What is editor overhead ? [2017.3] 4 Answers
Why does my Scene View use 100% processor 0 Answers
Prefabs in limbo causing HUGE lag 1 Answer
near/far Soft Particles work in editor but not in android 0 Answers
Gfx.WaitForPresent rant, and editor fix 0 Answers