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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Unity ads not showing "real" ads

Discussion in 'Unity Ads & User Acquisition' started by Khalouch, Nov 10, 2021.

  1. Khalouch

    Khalouch

    Joined:
    Jul 4, 2021
    Posts:
    1
    • I recently published my game on the google play store. But my ads are not working, I made sure to disbale test mode(I also enabled the Force TestMode thing) but still I get test ads. Any one knows why this happens?
    • This is the scripts for ads:
      Code (CSharp):
      1. using System;
      2. using UnityEngine;
      3. using UnityEngine.Advertisements;
      4.  
      5. public class AdManager : MonoBehaviour, IUnityAdsListener
      6. {  
      7.     [SerializeField] private bool testMode = false;
      8.  
      9.     private string gameId = "0000000";
      10.     private string videoAd = "Interstitial_Android";
      11.     private string rewardAd = "Rewarded_Android";
      12.    
      13.     private void Start(){
      14.         Advertisement.AddListener(this);
      15.         Advertisement.Initialize(this.gameId, this.testMode);
      16.     }
      17.  
      18.     public void ShowAd(){
      19.         // Check if UnityAds raedy before calling Show method:
      20.         if(Advertisement.IsReady(videoAd)){
      21.             Advertisement.Show(videoAd);
      22.         }
      23.         else{
      24.             Debug.Log("Ad not ready");
      25.         }
      26.     }
      27.  
      28.     public void ShowRewardedVideo(){
      29.         //Check if UnityAds is ready before calling Show method:
      30.         if(Advertisement.IsReady(rewardAd)){
      31.             Debug.Log("Showing Reward Ad");
      32.             Advertisement.Show(rewardAd);
      33.         }
      34.         else{
      35.             Debug.Log("Rewarded ad not ready");
      36.         }
      37.     }
      38.  
      39.     public void OnUnityAdsReady(string placementId){
      40.         Debug.Log("Ad Ready");
      41.     }
      42.  
      43.     public void OnUnityAdsDidError(string message){
      44.         Debug.Log("Error: " + message);
      45.     }
      46.  
      47.     public void OnUnityAdsDidStart(string placementId){
      48.         Debug.Log("Ad Started");
      49.     }
      50.  
      51.     public void OnUnityAdsDidFinish(string placementId, ShowResult showResult){
      52.         if(placementId == rewardAd && showResult == ShowResult.Finished){
      53.             Debug.Log("Reward Player.");
      54.             FindObjectOfType<PlayerHealth>().Revive();
      55.         }
      56.     }
      57. }
      58.  
     
  2. Unity_Quinn

    Unity_Quinn

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    102
    Hi @Khalouch, thanks for reaching out! I'm sorry to hear about this!

    I have a couple of questions/notes for you:
    1. Which SDK version are you using?
    2. I noticed that you aren't implementing IUnityAdsShowListener or IUnityAdsLoadListener as demonstrated in our integration guide: https://unityads.unity3d.com/help/unity/integration-guide-unity and are instead using what looks like our old example code. It's worth reviewing the new integration code and making the appropriate adjustments assuming you are using one of the more recent versions of our SDK.
    3. What are you using as your game ID? This can be found on the ad units page of your monetize dashboard. It is extremely important that you are using the correct game ID.
    I look forward to hearing from you so we can sort this out!