1
\$\begingroup\$

I'm having a problem with my 2D game on Android.

When I use OpenGLES 2.0 as the graphics API, I experience sudden FPS drops in the game. The game starts to slow down sometimes randomly, And it can drop down to 25 FPS sometimes (from 60). I tried debugging it, and nothing special was consuming CPU time or anything.

it was only GFX.Waitforpresent.

To fix this, I tried using Vulkan as the first Graphics API, and the other two OpenGLES APIs next. The problem of FPS drop is gone! never slows down again on my device.

But I had two other problems.

The first is the screen suddenly turn all white. This is again random! can't reproducde it easily. But it does happen. And when this happens sound can be heard and it's obvious the game is running, and it's just not rendering properly.

The other problem is game won't start on an old device a friend tested it on.

I've been testing this on my Huawei P10 Lite device with Android 8.

\$\endgroup\$
  • \$\begingroup\$ If you are experiencing sudden fps drops it's 99% of the time because the game is not optimized to run on mobile at a locked 60 frames per second; Vulkan is not a magic component that you add to your game to make it faster, unfortunately ;) I'd highly suggest you to profile your game in depth and look for instabilities/possible optimizations. The reason why the game didn't start on the older device, is most likely because it doesn't support Vulkan as a valid graphics API: drivers were not written for that specific device, so there is no way the game is going to run on it using Vulkan. \$\endgroup\$ – Gabriele Vierti Jan 3 '19 at 13:03
  • \$\begingroup\$ As I've already said, I have tried profiling. Nothing is keeping CPU active, and it's just GPU. And again nothing much is happening on GPU to keep it active! And again as I've already said using Vulkan stops the sudden drops. So it must have been the Graphics API, or how I'm using it, though it's a simple 2D game and nothing much is happening. I wonder why is this happening. I've used OpenGLES 2.0 as the secondary Graphics API too. Isn't Unity supposed to use OpenGLES 2.0 when Vulkan is not supported? \$\endgroup\$ – Paiman Roointan Jan 3 '19 at 21:57
  • \$\begingroup\$ If it doesn't do it when Automatic Graphics API is not selected, then what is the point of enabling multiple Graphics APIs and sorting them? \$\endgroup\$ – Paiman Roointan Jan 4 '19 at 0:04
  • \$\begingroup\$ some platforms support certain graphics apis better than the others \$\endgroup\$ – Gabriele Vierti Jan 4 '19 at 0:32
  • \$\begingroup\$ Not using Unity here but i'm experiencing the same problems with OpenGLES 3.0-3.2. My GL application runs smoothly at 60fps for about 30-50 seconds (always random, sometimes even later) and then just suddenly drops to solid 25fps for no apparent reasons. No changes whatsoever at the point of drop. No memory leaks, no more cpu usage. I haven't found the reason yet but it only seems to be a problem with my Honor 10. It does not happen on som other devices like my Vernee X. Any ideas yet? \$\endgroup\$ – theCNG27 Apr 1 '19 at 17:34
0
\$\begingroup\$

I upgraded my Unity to latest version (2018.3) and the problem with Vulkan is gone.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.