1

I am making a mobile game with unity and I plan to use UnityAds for monetization. I imported the "Unity Monetization 3.1.0" package from the asset store. When I run it in unity it looks like everything is working, but when I build it and test it on Android phone nothing happens.

This is my code:

    private void Start()
    {
        Advertisement.Initialize(gameId);
        StartCoroutine(ShowBannerWhenReady());
    }

    private IEnumerator ShowBannerWhenReady()
    {
        while (!Advertisement.IsReady(bannerId)) yield return null;
        Advertisement.Banner.Show(bannerId);
    }

EDIT:

Here are the logs:

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
Superblar
  • 96
  • 5
  • did you make proper settings on Unity cloud pages? there is tutorial for production ad setting. you should follow that. – Brian Choi Jul 18 '19 at 02:25
  • Do you see test ads or none at all? I had the same issue and it was just a timing thing. It doesn't happen immediately but eventually worked. Like next day from memory. – MomasVII Jul 18 '19 at 02:32

1 Answers1

0

It's working now. It looks like it was some bug with my Unity version. I just installed the latest Unity version 2019.1.10f1 (I was using 2019.1.8f1) and now everything is working.

Superblar
  • 96
  • 5