Android build project freezes after 5 minutes with playerloop in profiler at 60,000 ms

I am Developing an android game ,Which just had 1 scene, All Was fine now was the time to test it on the device , so i builded the game using build and run with developement mode enabled and auto connect profiler enabled , and game runs fine , but after some time like 5 to 15 min the game freezes , so i starting disabling everything in my scene with building and running again and again , now everything in my scene is disabled , And just 1 camera 1 plane and a fps counter is enabled and still when i build and run my game freezes after 5-15 min of run on the android device one plus 3t , This is the screenshot of the profiler after the freezing happened. Unity 2019.3.8f1

this this is annoying me so much because now everything on the scene is disabled , with just a camera a plane and a frame counter,
Please help me

Did you check the logcat? Maybe there are some errors?

Hi There Thanks For The Reply So For Logging I am Using"C:\Program Files\Unity\Hub\Editor\2019.3.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\monitor.bat" with unity filters , and i am not seeing any errors in there , to be precise all the logs for androids are showing , and for unity filter i can see default logs with tag info but no error Logs with tag Error “E” .

The error is not necessarily with Priority Error, you should filter by process id, not by Unity alone.

Try downloading Android Logcat package via Package Manager it has filtering by package.

Ok I will Try That And Post You Back

I encountered the same problem, and I haven’t found a solution yet. Have you solved it now?
Or already have a clue?

Unity 2019.3.8f1,Unity 2019.3.9f1,Unity 2019.3.10f1 same problem.

Ya sure I Fixed It By Disabling Optimized Frame Pacing In PlayerSettings>ResolutionAndPresentation>Optimized Frame Pacing , if This Works For You Then be Sure To Notify here , Welcome

8 Likes

Thank you for your help

Had almost the same problem with Unity 2019.3.10 and 2019.3.13 when running my game on a TCL Android TV. The game was freezing after 5min, only music was still playing. Disabling Optimized frame pacing fixed it. Thank you very much!

1 Like

Having the same problem with Unity 2019.4.12f1
Disabling Optimized frame pacing fixed it

I have the same problem with Unity 2020.1.4f1 and disabling optimized frame pacing didnt fixed.

What else can I do to fix this problem of the game freezing on android after a few minutes?

first you need to check if not any of tour scripts are causing the problem to do that try a build with no scripts with just the visuals and then gradually adding scripts to the build and testing , if the build without the script is also freezes that try monitering the profiler in rendering section the the vsync is taking over 999ms or not , also you can try disabling the vsync at first and us a fixed resolution . in short you need to figure out the cause then only you can solve the problem , try vsync fix,.

I disable vsync and it keeps freezing after a few minutes playing on my android. My game its a tower defense.

Before, the warning below appeared when I built the apk

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I already switched all OnMouseDown method for GetTouch and now no more warnings appear but the problem persists .

It is difficult for the game to run without a script because without the most important classes, which is turret, bullet and enemies the game does not work.

I’ve tried with just one scene, with only one type of tower, with a reduced amount of enemies, but it still freezes after a few minutes.

All you fixing this by disabling Optimized Frame Pacing, could you please report a bug in the (Editor via Help > Report A Bug) on this with your Project so that OFP can get fixed? If that leads to duplicates, that’s better than no reports as it just provides additional context narrowing this down.

1 Like

Hi MartinTilo, ty for answer.

I tested the game on a friend’s cell phone (a good one) and he played it without freezing. My cell phone is old and that must be the problem.

After seeing your signature on optmization, best practices and other things, I am improving some codes within the update methods and I believe that this will solve the situation. If not, I’ll be back. Thanks.

2 Likes

I had this problem too, and i now realize that Optimized Frame Pacing can be the cause of it, I was working on the app on a new device this morning and noticed a suddent and unexpected freeze, checking the log I found the same behaviour I described here: Unity freeze on long run application after migrate to unity 2019.3 and after a bit of googling I found this post.

Disabling Optimized Frame Pacing seems to have solved (so far) the issue.
@MartinTilo back in the days I sent a bug report about it (case 1254991) If is unavailable to you I’m happy to send another one if you need

That bug report was closed as it seemed tricky to nail it down. Reading through the history on that, it looks like it might’ve been resolved because the the default settings in a new 2019.4 build would be different than those of a project upgraded from 2017.4, but no determination was reached as to what that difference actually was? If that difference is the Optimized Frame Pacing setting or if there is a new and different expression of this that hinges on this setting, then a new bug report on this would be useful, yes :slight_smile: If it is as easy to reproduce as flipping that setting, that should be way easier to find with an example project and that hint.

I can confirm you that by toggling the Optimized Frame Pacing on and off the problem is sistematically reproduceable.

Using the Android Profiler (from android studio tools) under the CPU i can see the thread “filter0” and “filter1” appear ONLY when that option is toggle on, moreover, those two thread are basically idleing most of the time. When they idle the application works smoothly but, when they run no-stop (like in the picture) the application is freezed. No particular actions are done from app side to trigger those. I saw this situation with the app simple opened and left alone for a couple of hours.

I just sent a bug report for you with the same project I’m seeing this behaviour

1 Like

Hi,

Disabling the Optimized Frame Pacing option did not solve this for me. My app still freezes after about 7 hours of runtime.

Same problem here with Unity 2020.3.16f1, disabling Optimized frame pacing fixed the issue.

Anyone knows the status of this bug?