Rewarded video from AdMob in Unity - loading so slow

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 09:39:05

问题


Previously I used Unity Ads to display interstitial and rewarded ads in my game made with unity but now I'm switching to Google Ads (AdMob).

I read documentation from here and next from here and everything seems like it's working, but kinda slow.

I have 3 scenes:

  • Main Menu
  • Game
  • Shop

I need to display rewarded ads in Game and Shop scenes. In the Game scene, the user has the ability to watch an ad to continue where he dies. He have only 5 sec to do that. If he doesn't watch an ad, then he has the ability to watch another ad for +25 coins, to restart the game or to go to the main menu. From the Main Menu scene, the user has the ability to go to the store to buy some more characters and here he also has a button for +25 coins if he watches rewarded ad. So, there are 3 places for the rewarded ad.

In the Main Menu script, in the Start() method there is:

MobileAds.Initialize(appId);

The problem is, when the user clicks on the "Store" button in the Main Menu scene, in the Start() method I'm calling

// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the rewarded video ad with the request.
rewardBasedVideo.LoadAd(request, adUnitId);

and the user has the ability to immediately click on "View ad" button which does this:

if (rewardBasedVideo.IsLoaded()) {
  rewardBasedVideo.Show();
}

and there is a problem... Rewarded ad is still not loaded, it will be loaded after 1.5s - 2 s from calling rewardBasedVideo.LoadAd(request, adUnitId); So, the user must click it multiple times until ad appears.

I checked a lot of other games which uses AdMob and every game immediately show ads. How? Is there a way to preload rewarded ad?

It's also a bad UX when die modal appears and user have 5s to watch rewarded ad until he is "fully dead" but the ad is available after ~3s.

Also in the store, after watching the ad, user has ability to watch it again, so in OnAdClosed I putted the same logic for loading new ad but it's also slow and after few seconds the ad is actually loaded and I tested other games - they don't have that problem.

Do You have any advice?


回答1:


You need to call

rewardBasedVideo.LoadAd(request, adUnitId);

As soon as the app launches. This will load and prepare the ad for when the user is prompted to watch it.

I ussually have an empty gameobject with a script called "AdManager" which loads the ad. It has a static reference to itself (singleton pattern) so i can easilly call it from other scripts.

That way when the app launches, the ad is prepared and when I want to display it, i can call it from wherever i want to.

Regarding displaying a new one after the previous one has ended. I do not see a viable option other than physically having to wait untill it is loaded. (Keep in mind that an Ad can be pretty big in Data)



来源:https://stackoverflow.com/questions/52026833/rewarded-video-from-admob-in-unity-loading-so-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!