0
votes

The last few days I have been building a simple platformer to be deployed on Android Phones. However, after the last deploy to my phone, the framerate was bearly at 25fps on my quite fast Samsung S8. The game in the editor is somewhere at 100 fps and works fine. The game also worked fine on my S8 just a day before. I have not really changed anything, so what could be going on here? This is absolutely unacceptable. If you need further info, tell me!

Thank you!

This is from the profiler: enter image description here

2
You have to use profiler to understand what is going wrong.Ali Kanat
hi Ali, I set up the profiler. What am I to read from it?innomotion media
Check out what is blocking your main thread. You can click on it which will pause the game and then you can see every operation (Rendering, Scripts, Physics etc)at that particular frame and see which operation takes how many ms. Also it would be nice if you share screenshot of it here.Ali Kanat
I posted a screenshot. I hope it is really showing my phone and not anything else... (because even when the game is off in unity, the profiler is still doing something...)innomotion media
Sorry, NOW this is the correct screenshot from my phone !innomotion media

2 Answers

0
votes

I cannot tell you, why this happend but this was all I needed to do:

In any script that starts (like playermovement or what ever) add this line:

    Application.targetFrameRate = 60;

E voila.

I didnt have this line before and it worked but it stopped working. Adding this line fixed it entierely. Thank you all.

0
votes

First of all, try deducing number of Tries and Vertices in your Meshes, Use baked lighting to improve performance, Also try object pooling wherever possible, and generate Occlusion map to optimize your game for mobile devices. You can set quality settings from Unity for mobile devices. You will need to maintain LOD levels if you want more complex meshes to be rendered on your phone, and optimize game as much as possible to render it on mobile devices without any glitches. I will also recommend you to use this toolset, which will help you in optimization.

UPDATE If you have recently changed anything, which made your app performance Bad, then check you haven't added any Co-routine or IEnumetaror relative code that may iterate over time in separate thread in your recent changes, try using Collab to maintain versioning, as you can restore your previous code with help of collab anytime, in case you loose something, it is totally free and very useful.