- Home /
Low FPS in very simple Android game
I made a simple fps counter. On a computer, a value of about 1000 is displayed. On a mobile phone: 20 fps …
Working on the old version of Unity 5.6, Android games worked with high fps, but when switching to the new version (2020.3 and higher), all Android games began to work very slowly.
Computer operating system version: Windows 10, version 20H2.
Phone operating system version: Android 10 QP1A on Redmi 9.
I am attaching a link to download the original project with the apk file in a 7zip archive: https://www.dropbox.com/s/58wqawcmeoguh3i/Low%20FPS%20example.7z?raw=1
And what does the Profiler say to that?
Btw. your build target may have vsync
or some kind of fps targeting enabled. So this very well may turn out not to be a performance issue at all.
Disabling vsink did not help. FPS targeting is not set.
Here is the profile from the smartphone:
I am seeing few very bad things here:
abnormal GPU usage.
Mono.JIT
takes 150 ms (look into profilers'`Hierarchy` view to investigate it's origin)SerializeJSON
that takes 400 ms. Get a stack trace for this process
Here are some screenshots of the profiler hierarchy:
https://www.dropbox.com/s/ei55ekkv5bnhv72/profilerHierarchypart1.png?dl=0 https://www.dropbox.com/s/1hrrglo4uqv1es8/profilerHierarchypart2.png?dl=0 https://www.dropbox.com/s/n0v9ye6dqum2m02/profilerHierarchypart3.png?dl=0
But I could not understand the reason for such long processes.
VSync cannot be disabled on android & iosDisabling vsink did not help
Since PlayerLoop
/TimeUpdate "waits for the operating system" while WaitForLastPresent waits for GPU I suspect this is probably a situation where both CPU and GPU are idle but must stay in sync with the hardware resulting in both doing nothing but waiting for each other. So, in short, this is not a good testing setup.
Try testing a case where there is something actually to do for cpu and gpu.
For the CPU load, I used the sine, cosine and tangent calculations of the random angles in each frame. For the GPU load, I made 3 point lights and 72 randomly rotating capsules.
FPS remained the same: 20 fps… Profiler screenshot: https://www.dropbox.com/s/czmkj4tml0sxi3t/profilerWithCPUandGPULoad.png?dl=0
Answer by DenisIsDenis · Jul 07, 2021 at 07:28 AM
Yeah… After a lot of experiments, during which I tried a lot of solutions to the problem (which could not increase the number of frames per second to 60), I still achieved 60 fps in mobile games.
What I've done? I have installed Unity 5.6.7f1. In order to compile games on Android devices, I needed JDK 8, because Unity 5.6.7 did not want to work with newer ones. After that, I compiled an empty game for a smartphone and the FPS increased to 60! (in new versions of Unity 2017 - 2021, such scenes gave a maximum of 30 fps (I checked)).
Conclusion: I decided for myself to use Unity 5.6.7f1 to create mobile games.
Note: I have verified that the JDK version does not matter - I tried using JDK 8 in the new version of Unity, but the fps remained low.
Link to Unity 5.6.7f1 download page (just in case anyone needs it):
https://unity3d.com/get-unity/download/archive
EDITED on November 27, 2021:
My Redmi 9 was upgraded from Android 10 to Android 11. Changes:
Firstly, I was able to profile the GPU (there was an error earlier that the device does not support GPU profiling).
Secondly, applications that previously showed a maximum of 30 FPS now display 60 FPS.
Together with Android, the MIUI firmware was updated to 12.5.1 and it was reported that the rendering was optimized.
In a word, now games from any version of Unity work like clockwork!
Your answer
Follow this Question
Related Questions
Unity 2019.3 LWRP strange Performance Issue on android 0 Answers
Serious performance issues 0 Answers
Android Performance REALLY Laggy 2 Answers
Android version has very low FPS, but the iOS version is fine? 0 Answers
Unity Trees Destroy Performance 0 Answers