Unpredictable lags on android

Hello. I’ve made a 2d game that runs well when I enter play mode in unity editor on my pc but when I build apk and install it on my Android smartphone, the game eventually starts lagging hard and turns off. The problem is it seems to happen unpredictably - I can play it an hour and nothing goes wrong but than it can start dropping fps like 100-200 times after 5 minutes of gameplay, freezes and turns off, sometimes killing saves randomly.

I thought it might be connected to coroutine pseudo-animations, sounds or auto saves, so, I turned everything off…and it still happens!

I didn’t notice any memory losses for the phone as other apps run normally when I simply switch to them when the lags start, so, it’s probably not a memory leak.

I have no idea how to find the source of this lags that only happen on the phone. So desperate - I’m ready to drop a several month’s working at nights with unity and go for unreal Engine (will obviously have to convert everything from c# to c++ and learn the scene building all from the start) or even write my own graphics, sound, etc. Interactions. But that’s not for the newbies that I currently am.

Please, help!!

You should do a development build with Auto Connect Profiler selected and you should be able to determine the source of the issue from the profiler report produced when the game is run on the device.

Thanks! I’ll read about it and try it out as soon as I get the idea of how it works.

This might be of some help Diagnosing Performance Problems - Unity Learn

Well, can’t connect the device neither via cable nor Wi-Fi. There are probably some extra nuancea not described in the manual, I’ll dig further.