Unity Ads Newbie Questions about Implementing

So im coming from buildbox where ad implementation and coding was done for us. Ive rebuilt my game in unity. But i can’t for the life of me figure out how to make ads show. (the last thing i need to do before i can update the current Live app).

Im basically dropping this code

using UnityEngine;
using UnityEngine.Advertisements;

public class InterstitialAdsScript : MonoBehaviour {

   string gameId = "1234567";
   bool testMode = true;

   void Start () {
       // Initialize the Ads service:
       Advertisement.Initialize (gameId, testMode);
       // Show an ad:
       Advertisement.Show ();
   }
}

On to the home screen. to see if it will just display an ad on launch. (ive changed the Gameid to mine from the dashboard)

Ive tried doing that without the advertisement.show and putting it after a button click. For example.

public void OnSettingsButtonPressed()
        {
            Advertisement.Show();

            OpenPopup<SettingsPopup>("Popups/SettingsPopup", popup => { });
        }

Is there some simple step that im missing here?

Unity ads are enabled in the game. Test mode is on. My placement on the ads dashboard is video. The game id is there. and the project is linked.

Like i said, i can understand code, but writing and knowing where to put things is trickier for me.

Thanks in advance, im sure someone is going to come in here and tell me im an idiot just do this lol. I can only hope is as easy as that.

The SDK usually takes a few seconds to initialize as it needs to contact our servers to request your project’s configuration details and then download and cache ad content before an ad can be played. That means your first code segment won’t work as you’re trying to show an ad immediately :slight_smile:

I’m not sure why the ads might not show from your second code segment. Do you have any logs from the device?

Also, you can check our documentation here for our full integration guide
https://unityads.unity3d.com/help/unity/integration-guide-unity