Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Ads not sowing after build

Discussion in 'Unity Ads & User Acquisition' started by svenvanh, Jan 1, 2021.

  1. svenvanh

    svenvanh

    Joined:
    Nov 29, 2019
    Posts:
    51
    Hi, I've implemented unity ads a couple of weeks ago and now I want to use it. In the editor you see the ad banner with "this would be your banner" but after I've built the game and run it on my phone it doesn't show an ad.

    I'm using unity 2020.1.2f1.
    Development build is off in the Build settnigs
    ads are turned on in the services tab.
    test mode is off (both in the editor and in the code).
    the game ID's are correct (again both in the editor and in the code).
    placementid is correct.

    Does anyone know what I've done wrong or what I need to enable in the build settings?
    thanks!

    this is my code (not my real gameID):
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using UnityEngine.Advertisements;
    4.  
    5. public class adScript : MonoBehaviour
    6. {
    7.  
    8.     public string gameId = "1111111";
    9.     public string placementId = "BannerBottom";
    10.     public bool testMode = false;
    11.  
    12.     void Start()
    13.     {
    14.         //Advertisement.Initialize(gameId);
    15.         //StartCoroutine(ShowBannerWhenInitialized());
    16.  
    17.         Advertisement.Initialize(gameId, testMode);
    18.         StartCoroutine(ShowBannerWhenInitialized());
    19.     }
    20.  
    21.     IEnumerator ShowBannerWhenInitialized()
    22.     {
    23.         while (!Advertisement.IsReady(placementId))
    24.         {
    25.             yield return new WaitForSeconds(0.5f);
    26.         }
    27.        
    28.         Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER);
    29.         Advertisement.Banner.Show(placementId);
    30.  
    31.     }
    32. }
    33.  
     
  2. burak11581999

    burak11581999

    Joined:
    May 4, 2020
    Posts:
    4
    Where do you live? Unity banner ads are not showing or barely showing in some countries like Turkey.
     
  3. Umittty

    Umittty

    Joined:
    Oct 13, 2020
    Posts:
    1
    Why? Bende iki gündür niye çalışmıyo diyorum :(
     
  4. Unity_Adamski

    Unity_Adamski

    Unity Technologies

    Joined:
    Jul 20, 2020
    Posts:
    110
    Hi, normally this is caused by accidentally leaving the checkbox enabled in the editor, being a public bool the editor option will overwrite it's initial state. It is also possible that you are initializing the SDK elsewhere with testMode set to true. This is a fairly common mistake.

    Failing this you can go into the project settings for this project on the Unity Dashboard and use the Force Test Mode options to force testMode on or off for your application. Bare in mind however that this will effect ALL builds of your app.
     
  5. svenvanh

    svenvanh

    Joined:
    Nov 29, 2019
    Posts:
    51
    Hi, thanks for the reply.
    I enabled "Force test mode off" in de unity dashboard but sadly that didn't solve the problem. I'm still not seeing the ad after I've built it. I live in the Netherlands so I'm not sure if there are ads in my region but I'm hoping you maybe have another solution?

    Thanks!
     
  6. Unity_Adamski

    Unity_Adamski

    Unity Technologies

    Joined:
    Jul 20, 2020
    Posts:
    110
    Hi, it is very possible then that this is a banner fill issue. The easiest way to tell if this is the case is to inspect the device logs for your app. You can most easily do this by using the Android Logcat package for Unity or by using Logcat via the Android Studio. You can find instructions on using it here.

    Once you have the logs you will be looking for messages with the UnityAds tag. Try looking for any logs that say something along the lines of 'Error: No fill for Banner placement'. If you don't see this log it is likely that your issue lies elsewhere.
     
  7. svenvanh

    svenvanh

    Joined:
    Nov 29, 2019
    Posts:
    51
    Thanks for the reply again!
    I was just about to do the thing you said until I started up unity and saw these errors.
    upload_2021-1-15_7-17-36.png

    Normally I just ignored them because my game seemed to work but when then I saw something about com.unity.ads.
    do you have any idea on how to fix those errors? and are these errors maybe the problem?
    This is the folder the error is coming from:
    upload_2021-1-15_7-28-34.png
     
  8. Unity_Adamski

    Unity_Adamski

    Unity Technologies

    Joined:
    Jul 20, 2020
    Posts:
    110
    Hi, it looks like you may have multiple instances of the Unity Ads SDK added into your project. As the images you have sent are part of the template ads project.