I am trying and trying to enable google ads in my unity3d game, but no success… I have google developer console, have AdMob and I have unity3d app ready to be published, only thing that is left to be done is to enable ads. So, I make an add unit at my AdMob account to get id of the add. I have followed this tutorial https://developers.google.com/mobile-ads-sdk/docs/games#unity and with compiling and so on, everything is good, but when I want to see the ads, they are not showing. Not in the editor, not in the device. Here is my script with code to show banner ad:
using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
// Example script showing how to invoke the Google Mobile Ads Unity plugin.
public class ads : MonoBehaviour
{
void Start ()
{
RequestBanner ();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
}
I have this script, named ads.cs attached to main camera in the game… I really don’t know why ads are not shown, please, if anyone know what the problem is, help me.
Just as a heads up. For anyone who was looking around for a solution to this. If you have it working in the editor, are receiving all the right debug messages and have set up your admob account to work properly, it does take some time for AdMob to register your account properly. I set this up yesterday and for the life of me could not get the ads to display in my app. I opened the app this morning and they started displaying. So rest easy if you have followed all of the instructions here: शुरू करें | Unity | Google for Developers and still don’t see your ads, you may just need to wait a bit for admob to register your ads properly.
*Edit: It might be worth noting that I did upgrade to 5.6.1p4 in the process as well as setup my payment information in admob (as I think this is the point when your information is submitted to admob for them to set up your ads).
Make sure you have completely imported the AdMob plugin package. I had somehow managed to only import a part of it and re-importing fixed the issue. Also try debugging with logcat, I had no errors in the editor but logcat was complaining about some plugins missing .