AdMob Unity Slows Game (low framerate)

2,342 views
Skip to first unread message

Stephen Abrard

unread,
Oct 16, 2014, 10:05:53 AM10/16/14
to google-adm...@googlegroups.com

Hi, like suggested in this thread http://answers.unity3d.com/questions/810267/admob-highly-slowing-game-framerate.html I post the problem here.

It seems like ads are slowing my game a lot.
I created a scene only with GoogleAdDemoScript in my project, which contains other scenes.
I begin with the Demo scene and then when I press back i go back to a menu.

When I do like, creating banner/interstitial and showing them, then destroy them or not, if I go to the menu, then it is really slow.

The only thing I found which works perferctly is for banners. If I request a banner then hide it, then it is smooth everywhere.

But the thing is, I really can't use at all the ads during game otherwise it slows the framerate. The only thing I found is creating a scene especially for ads, show a banner, wait, hide it , then go back. A bit heavy... could you help please?

Eric Leichtenschlag

unread,
Oct 16, 2014, 8:23:38 PM10/16/14
to google-adm...@googlegroups.com
Unity apps are resource intensive and the WebView from ads pushes these resources to the limit. We're looking into some CPU issues that ads are having in regard to CSS animations, but WebViews in general just consume resources. In your case, I'd recommend working around this by only showing ads at stopping points in your app (pause screen, end of game) and/or interstitial ads.

Thanks,
Eric

Stephen Abrard

unread,
Oct 17, 2014, 7:57:00 PM10/17/14
to google-adm...@googlegroups.com
Thanks for answering.

Well, as I noticed that only banners worked for me, I did a "pause" in the game where I show a banner rect, so let's say it will be fine.

However, it is weird that even only the "Hide" function works and doesn't slow down the framerate.

Good luck optimizing, keep up the good work.

Eric Leichtenschlag

unread,
Oct 17, 2014, 10:22:32 PM10/17/14
to google-adm...@googlegroups.com
Hmm. Hiding the banner also pauses the WebView, but that doesn't actually pause CSS.

I think another possible contributing factor could be that the ad is sitting on top of the Unity game, increasing GPU overdraw. I've been unable to figure out how to make the ad a sibling of the game view instead of being drawn on top, but it's also unclear that you'd even want that behavior, since it makes your game smaller and could make rendering look "janky" when you hide/show the banner. In that case I'm unsure how to proceed.

Stephen Abrard

unread,
Oct 19, 2014, 10:36:50 AM10/19/14
to google-adm...@googlegroups.com
You know, I do have 5 years of study in programming, but I'm not an expert in Java/Android at all.

The thing I find quite strange is the following:

How can an Ad be hidden, without slowing the framerate whereas Destroying it (instead of hide), still slows the game ?
I mean when I destroy it, it is really destroyed (can't access it anymore) and I can't see it anymore, but the game stays laggy after.
If I Hide, no problem, smooth.

I would be interested if you know a way to make the ad not being on top of the Unity Game then. I don't understand the part you said that it would make the game smaller, but I think maybe it is worth a try.

Anyway, thanks for so much feedback, I tested the app on other devices from friends, and the "pause scene" I made for the banner works well.

Christer William Persson

unread,
Oct 19, 2014, 11:27:46 AM10/19/14
to google-adm...@googlegroups.com
I'm facing the same issues as Stephen. What I've noticed is that the problem is more apparent on different phones. The strange thing is that it's more apparent on my Nexus 5 than on my 3 year old Samsung Galaxy SII (which obviously has worse performance) on which the frame drops were barely noticeable. The thing is that i've tested it on yet another Samsung Galaxy SII, where the frame drops were as apparent on the Nexus 5, or even more apparent.  The only real difference between the Samsung phones that I could see was that the one running smoothly was running on Samsung's (crappy) TouchWiz while the other was running CyanogenMod.

Hope that helps!

Eric Leichtenschlag

unread,
Oct 20, 2014, 3:45:49 PM10/20/14
to google-adm...@googlegroups.com, christer...@gmail.com
All the other examples I've seen use the same technique of placing the ad (or some view) on top of the game. As far as I know, Unity doesn't exactly provide a plugin their game view that you can mess around with.

While ad performance in Unity is a known issue, I think it's a limitation of the platform, with the best workaround being don't show ads during gameplay where fps is important.
Reply all
Reply to author
Forward
0 new messages