- Home /
Android performance problems in landscape mode, but not portrait
My game runs at a solid 60 FPS in portrait mode, but in landscape mode it sometimes struggles to even hit 30.
To make sure this wasn't a problem with my game specifically, I:
Created a fresh project from the URP template in Unity 2019.3.11f1.
I the sample scene, I deleted all the models (leaving only the camera and the light).
Added a script to the main camera which sets Application.targetFrameRate to 60 and QualitySettings.vSyncCount to 0.
This project also gets a solid 60 FPS in portrait, but drops to 30 in landscape mode (whether by auto-rotation or setting landscape mode as the default orientation in the player settings).
On my OnePlus 3T with the profiler attached, this is what I see with the URP project mentioned above in portrait mode:
And this is what I see in landscape mode (during the same run of the game; I just rotated my phone 90 degrees and waited a few seconds to make sure performance wasn't being affected by the rotation animation itself):
Notice that in one of the spikes I have selected, Gfx.WaitForPresentOnGfxThread is taking over 6x as long in landscape mode as in portrait. Even when it's not spiking, that function alone is taking 2-3x as long as in portrait mode.
Has anybody else experienced this? This seems like very strange behavior, but given that it's happening in the URP template project, it seems like it's engine-level.
Answer by kobyfr · Nov 21, 2020 at 05:18 AM
Hello TerminalP. Yes, I've found this problem today as well.
Target : Samsung SM-A530F (A8), Android 9
IDE : Unity 2019.4.12f1, SDK Android 26
Project Android settings : Android minimum API level 19 (Android 4.4 KitKat)
Project : default 2D, minimal - canvas, text UI showing FPS, updates every 500 msec, Application.targetFrameRate set to 60
No profiler attached
Switch to portrait, get around 59.7 FPS. Switch to Landscape, after several seconds, FPS drops to 40-45. While touching the control bar (move finger across back, task switch, home) in landscape, FTP rises back to 59.7.
When activating "Force GPU rendering" and "Disable HW overlays" in "Developer options", FPS in landscape is 59.7, and does not drop.
Tried the same on Samsung A7, and Samsung Galaxy Tab 2 - problem does not occur, FPS is ~60, even with the above-mentioned developer options, disabled.
2021/04/02 - Found a solution
Change project settings:
Android settings --> Other settings --> Auto Graphics API set to true