Ads not showing up...

Hi. i am trying to implement ads code in my game. But unfortunately they are not showing up. I have assigned banner Ad script to a game object. Should i publish the game on play store to see if it working? There are no warnings or errors.

Help Required thanks. Code is given below. Same is the case with Interstitial

Code 1 Example:

using GoogleMobileAds.Api;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AdScript : MonoBehaviour {

    // Use this for initialization
    void Start () {

        showBannerAd();
       
    }

    private void showBannerAd()
    {
        string adID = "ca-app-pub-3940256099942544/6300978111";

        //***For Testing in the Device***
        AdRequest request = new AdRequest.Builder()
       .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
       .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b")  // My test device.
       .Build();

        //***For Production When Submit App***
        //AdRequest request = new AdRequest.Builder().Build();

        BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);
        bannerAd.LoadAd(request);
    }

    // Update is called once per frame
    void Update () {
       
    }
}

Code 2 Example:
using UnityEngine;

using System.Collections;

using GoogleMobileAds.Api;

using System;

public class AdManager : MonoBehaviour

{

//THE SCRIPT HAS ORIGNAL ID’S OF ADMOB

InterstitialAd interstitial;

BannerView bannerView;

// Use this for initialization

void Start()

{

RequestBanner();

RequestInterstitial();

}

public void RequestBanner()

{

// replace this id with your orignal admob id for banner ad

string adUnitId = “ca-app-pub-3940256099942544/6300978111”;

// Create a 320x50 banner at the top of the screen.

bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);

// Create an empty ad request.

AdRequest request = new AdRequest.Builder().Build();

// Load the banner with the request.

bannerView.LoadAd(request);

bannerView.OnAdLoaded += HandleOnAdLoaded;

}

void HandleOnAdLoaded(object a, EventArgs args)

{

print(“loaded”);

bannerView.Show();

}

public void RequestInterstitial()

{

string adUnitId = “your interstial ad id here”;

// Initialize an InterstitialAd.

interstitial = new InterstitialAd(adUnitId);

// Create an empty ad request.

AdRequest request = new AdRequest.Builder().Build();

// Load the interstitial with the request.

interstitial.LoadAd(request);

}

public void show()

{

if (interstitial.IsLoaded())

{

interstitial.Show();

}

}

}

There are a lot of callbacks you can use to debug. Start by checking if there are any received or failed to load events.

It’s funny how similar questions seem to come up in batches on these forums.

Do take a read through of this recent thread. It is basically identical to this thread so the general discussion will be relevant to you. :slight_smile: