googleads / googleads-mobile-unity

Official Unity Plugin for the Google Mobile Ads SDK
https://developers.google.com/admob/unity
Apache License 2.0
1.34k stars 1.09k forks source link

Slow Rendering Android #748

Closed Wolar closed 5 years ago

Wolar commented 5 years ago

We are basically facing same issue that is mentioned here https://github.com/googleads/googleads-mobile-unity/issues/557 but since this issue appeared we experienced >95% drop in downloads so it seems that Android Vitals team are punishing us for this.

We have: Unity 2018.2.0 (we have tried 2018.2.4 as well with same results) AdMob 3.15.0

The problem is that Android Vitals are not tracking OpenGL content, so that means that the only thing they track are Ads. The problem is that for some Ads we get over 70% janky frames (Interstitial and Reward based ads).

What is also strange is that it appears that if we take better device, we get more janky frames which is really strange. It also depends on the Ad itself where some of the are quire okish while others not.

This is for example Samsung S8 after playing few ads: Stats since: 223959798464063ns Total frames rendered: 6875 Janky frames: 3500 (50.91%) 50th percentile: 16ms 90th percentile: 24ms 95th percentile: 26ms 99th percentile: 34ms Number Missed Vsync: 21 Number High input latency: 0 Number Slow UI thread: 720 Number Slow bitmap uploads: 7 Number Slow issue draw commands: 2613

When profiling this in Android studio, CPU usage is around 0-5% and memory usage is stable.

We have also tried to create empty project with just AdMob integrated. And while slightly better we still got over 50% janky frames for some ads on high end devices.

We have one more app with older versions of Unity (2018.1.4) and AdMob (3.13.1) plugin where the issue appears as well but is not as bad as with out other app.

Steps to reproduce:

Wolar commented 5 years ago

I have tried to update our other app to Unity 2018.2.0 and AdMob 3.15.0 and it's way better than the first app but it still generates quite a lot janky frames (around 10%). There is however no difference between versions of Unity and AdMob

Wolar commented 5 years ago

So I've spent like 5 days trying to dig out why or how it happens and I'm now pretty confident I know the cause.

The problem seems to be in displaying Interstitial or Reward while Banner Ad is active or loaded but hidden but it happens only for some banners.

For example: Forge of Empires (video) + Wish (banner) = 90% janky frames Forge of Empires (video) + Creative Dock (banner) = 16% janky frames

Edited post above to include this info

Wolar commented 5 years ago

Ping We have also encountered one more problem that might be related to this. When opening the ad (interstitial or reward) for the first time after installing the app (or wiping app data) there are at least 2 or 3 frames at the start of the Ad that takes 200+ms (sometimes even 750+) which is really bad as those 700+ frames are killing another vital - Frozen Frames.

Steps to reproduce: Create project in Unity (tested on 2018.2.0 abd 2018.3.0b5) Import latest Google AdMob plugin Deploy to Android device (tested on S6 and S9, Android 8) Load the Ad, Run the Ad Run adb shell dumpsys gfxinfo

rampara commented 5 years ago

@Wolar as this plugin does not perform any of the ad rendering (handled by the Android Google Mobile Ads SDK), there's not much this plugin can do for improvement. I have reached out to the Android SDK team and they are prioritizing performance improvements. However, you reach out on the Google Mobile Ads Technical Support Forum for further support.

alishehroz commented 4 years ago

@Wolar bro did you find any way around as these ADS really hurting the download graph.