1
\$\begingroup\$

I have an Android game, and everything works perfectly in the Editor, but when I run it on my Android device, it crashes sometimes.

This is how it goes: I'll be playing my game, and randomly, or because of a reason that I don't know, the game will quickly drop in FPS, it starts to go slower and slower until it's frozen at 1 FPS. Changing scenes when it starts to slow down, is possible, but it ends up crashing anyway.

It's not a device issue since it has happened on multiple devices.

It's also not a scene-specific crash. It's happened on my menu scene, game scene, and level creator scene.

It happens very rarely, today it took me about an hour of playing until I could replicate this bug, it eventually happened, and this time I had the profiler attached:

enter image description here

As you can see, VSync goes up to 5000+ms, the function causing the problem seems to be:

PlayerLoop -> PostLateUpdate.FinishFrameRendering -> Gfx.WaitForPresentOnGfxThread -> WaitForTargetFPS -> Semaphore.WaitForSignal

But I haven't found out exactly what this is or how to solve it.

Does anyone know how to fix this?

\$\endgroup\$
2
  • \$\begingroup\$ here is what i would do (in order): 0. connect to logcat and see the crash error 1. Test with an empty scene, if it still crash, then change unity version 2. Disable your "Don't destroy on load" objects and test your scenes one by one also vSync always seems like its doing a lot of work, most of the time you can just ignore that \$\endgroup\$ Dec 9, 2021 at 19:19
  • 1
    \$\begingroup\$ @alaslipknot Thank you, I will try all of that after I try my answer, after digging deep, I found a few people with the same problem, and they try it with empty scenes and it crashes/freezes anyways. But I don't think the crash will log since it seems to be sort of an infinite loop or something that has a similar result. \$\endgroup\$ Dec 9, 2021 at 19:25

1 Answer 1

0
\$\begingroup\$

After digging really deep, I found that some people fix this by disabling Optimized Frame Pacing In PlayerSettings>ResolutionAndPresentation>Optimized Frame Pacing.

I'm going to try that and tell you if it worked, if you try it, please let me know if it fixed it for you.

Here is where I found this information:

https://forum.unity.com/threads/and...h-playerloop-in-profiler-at-60-000-ms.863143/

https://forum.unity.com/threads/uni...ication-after-migrate-to-unity-2019-3.907628/

https://forum.unity.com/threads/whats-the-optimized-frame-pacing-feature.636847/

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Seems to work for now \$\endgroup\$ Dec 9, 2021 at 21:28
  • \$\begingroup\$ Then mark it as solved by clicking the checkmark on the left :). \$\endgroup\$
    – Banana
    Feb 1 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .