Can't get Unity Ads working

Hi there, Hopefully I’m not just being thick but I cant get Unity ads to work at all. Nothing comes up and Im sure i’ve followed all the instructions correctly.

I imported the asset from the asset store.

I then created this script which a button calls the function which i know is worked because debug.log is displayed in the console. (for “ID Num” I used the 5 digit game id number from the unity ads dashboard as this game is not yet published)

using UnityEngine;
using UnityEngine.Advertisements;
using System.Collections;

public class AdsScript : MonoBehaviour {

    // Use this for initialization
    void Awake ()
    {
        Advertisement.Initialize ("ID NUM", true);
    }
   
    public void ShowAd()
    {
        Debug.Log ("Show Add");
        if (Advertisement.isReady ())
        {
            Advertisement.Show();
        }
    }
}

Any idea what I am doing wrong? Thanks

So it works the second time i click the button but not the first

It could be that you’re hitting the button before Unity Ads has finished initializing.

Try updating your ShowAd method to something like this:

public void ShowAd()
{
    if (Advertisement.isReady ())
    {
        Debug.Log ("Show ad.");
        Advertisement.Show();
    }
    else
    {
        Debug.LogWarning ("Unable to show ad. Placement zone is not yet ready.");
      
        if (!Advertisement.isInitialized)
        {
            Debug.LogWarning ("Unity Ads is not yet initialized.");
        }
    }
}

Thanks