1

In my case its seems like the unity's test ads are showing up only in editor. I dont see any test ads window in my device(Samsung S7). Anyone know fixes for this? I post the code here and I called the PlayInterstitialAd() methid when the game is over. I'm using unity 2019.3.10 and unity monetization 3.4.4 Many Thanks

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

public class AdsManager : MonoBehaviour, IUnityAdsListener
{
    private string playStoreID = "123";
    private string apsStoreId = "123";

    private string interstitialAd = "video";
    private string rewardedVideoAd = "rewardedVideo";

    public bool isTargetPlayStore;
    public bool isTestAd;

    private void Start()
    {
        Advertisement.AddListener(this);
        InitAds();
    }

    public void InitAds()
    {
        if (isTargetPlayStore)
        {
            Advertisement.Initialize(playStoreID, isTestAd);
            return;
        }

        Advertisement.Initialize(apsStoreId, isTestAd);
    }

    public void PlayInterstitialAd()
    {
        if (!Advertisement.IsReady(interstitialAd))
        {
            return;
        }

        Advertisement.Show(interstitialAd);
    }

    public void PlayRewardedAd()
    {
        if (!Advertisement.IsReady(rewardedVideoAd))
        {
            return;
        }
        Advertisement.Show(rewardedVideoAd);
    }

    public void OnUnityAdsReady(string placementId)
    {
        //throw new System.NotImplementedException();
    }

    public void OnUnityAdsDidError(string message)
    {
        // throw new System.NotImplementedException();
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // throw new System.NotImplementedException();
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // throw new System.NotImplementedException();
    }
}
Thisara
  • 644
  • 3
  • 11
  • 22

1 Answers1

1

This is probably because the package is outdated. In my case it didn't work because I used the unity monetization version of the asset store instead of the one in the unity package editor, cause since version 2018.3 it stopped working.

enter image description here