Unity Ads广告在手机上显示不了
用了Unity Ads的插件,在Unity编辑器下可以测试正常,也说正常显示广告。但当我打包APK放到手机上时,就不显示了,下面是我的代码和后台截图。。。。有谁知道为什么吗?我挂VPN还是显示不了。。。
using UnityEngine; using UnityEngine.Advertisements;
public class Ads : MonoBehaviour {
void Start()
{
if (!Advertisement.isInitialized)
{
Advertisement.Initialize("1172479", false);
Debug.Log("1172479");
}
else
{
Debug.Log(">>>>>><<<<<<<");
}
}
public void ShowAd()
{
print(Advertisement.IsReady());
if (Advertisement.IsReady())
{
Advertisement.Show();
}
}
public void ShowRewardedAd()
{
if (Advertisement.IsReady("test"))
{
var options = new ShowOptions { resultCallback = HandleShowResult };
Advertisement.Show("test", options);
}
}
private void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("The ad was successfully shown.");
//
// YOUR CODE TO REWARD THE GAMER
// Give coins etc.
break;
case ShowResult.Skipped:
Debug.Log("The ad was skipped before reaching the end.");
break;
case ShowResult.Failed:
Debug.LogError("The ad failed to be shown.");
break;
}
}
}
bhafa7d8q9-dy6t-ydzb.png
(24.2 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612095046im_/https://answers.unity.com/themes/thub/images/avi.jpg)