就我而言,似乎统一的测试广告只显示在编辑器中。我在我的设备(三星 S7)中没有看到任何测试广告窗口。有谁知道解决这个问题?我在这里发布了代码,并在游戏结束时调用了 PlayInterstitialAd() 方法。我正在使用 unity 2019.3.10 和 unity monetization 3.4.4 非常感谢
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();
}
}