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.
↧