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();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.