我正在团结一致地制作一款手机游戏,并计划使用UnityAds获利。我从资产商店导入了“ Unity Monetization 3.1.0”程序包。当我统一运行它时,似乎一切正常,但是当我构建它并在Android手机上对其进行测试时,没有任何反应。
这是我的代码:
private void Start()
{
Advertisement.Initialize(gameId);
StartCoroutine(ShowBannerWhenReady());
}
private IEnumerator ShowBannerWhenReady()
{
while (!Advertisement.IsReady(bannerId)) yield return null;
Advertisement.Banner.Show(bannerId);
}
编辑:
以下是日志:
07-18 03:37:02.222 10741 10761 D UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:127) :: Wrote file: /data/user/0/com.noname.minigame01/files/UnityAdsStorage-public-data.json
07-18 03:37:02.223 10741 10761 D UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:81) :: Couldn't send storage event to WebApp
07-18 03:37:02.226 10741 10761 D UnityAds: com.unity3d.services.core.misc.Utilities.writeFile() (line:127) :: Wrote file: /data/user/0/com.noname.minigame01/files/UnityAdsStorage-public-data.json
07-18 03:37:02.226 10741 10761 D UnityAds: com.unity3d.services.core.device.Storage.sendEvent() (line:81) :: Couldn't send storage event to WebApp
07-18 03:37:02.228 10741 10761 D UnityAds: com.unity3d.services.ads.UnityAdsImplementation.initialize() (line:47) :: ENTERED METHOD
07-18 03:37:02.253 10741 10761 D UnityAds: com.unity3d.services.UnityServices.initialize() (line:41) :: ENTERED METHOD
07-18 03:37:02.253 10741 10761 I UnityAds: com.unity3d.services.UnityServices.initialize() (line:79) :: Initializing Unity Services 3.1.0 (3100) with game id XXXXXXX in production mode
07-18 03:37:02.258 10741 10761 I UnityAds: com.unity3d.services.UnityServices.initialize() (line:90) :: Unity Services environment check OK
07-18 03:37:02.292 663 10818 I netd : ;; res_nquery(config.unityads.unity3d.com, 1, 1)
07-18 03:37:02.378 663 10818 I netd : ;; res_nquery(config.unityads.unity3d.com., 1, 1)
07-18 03:37:02.464 10741 10817 E UnityAds: com.unity3d.services.ads.configuration.AdsModuleConfiguration$1.run() (line:60) :: Couldn't get address. Host: config.unityads.unity3d.com: Unable to resolve host "config.unityads.unity3d.com": No address associated with hostname: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
07-18 03:37:02.464 10741 10816 I UnityAds: com.unity3d.services.core.configuration.InitializeThread$InitializeStateConfig.execute() (line:191) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/3.1.0/release/config.json
答案 0 :(得分:0)
现在正在工作。看来我的Unity版本有一些错误。我刚刚安装了最新的Unity版本2019.1.10f1(我正在使用2019.1.8f1),现在一切正常。