Search Unity

C# script for unity ads

Discussion in 'Scripting' started by street9605, Jul 14, 2018.

  1. street9605

    street9605

    Joined:
    Jun 14, 2018
    Posts:
    5
    Hello!
    So my unity ads are all set up. In the unity simulator everything is working ("Everything seems to be working"). But now, my app is on the AppStore and there is no ads showing.
    Anyone who knows whats the problem ? Is it in my code? please help


    My code:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Advertisements;
    3.  
    4. public class Ads : MonoBehaviour
    5. {
    6.  
    7.  
    8.  
    9.     static int loadCount = 0;
    10.  
    11.     void Start()
    12.     {
    13.         if (loadCount % 3 == 0)  // only show ad every third time
    14.         {
    15.             ShowAd();
    16.         }
    17.         loadCount++;
    18.     }
    19.  
    20.     public void ShowAd()
    21.     {
    22.         if (Advertisement.IsReady("video"))
    23.         {
    24.             Advertisement.Show("video");
    25.         }
    26.     }
    27. }
     
  2. Glubker

    Glubker

    Joined:
    Aug 23, 2021
    Posts:
    1
    Did you forget to turn off test mode in the ad settings?
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    If you've got an Android build, you can still run logcat and see if any errors are being thrown. Otherwise, make sure you have all your ad IDs set up correctly.

    Possible issues might be that your ads IsReady never returns true as well. You probably want to add some ways to debug a build that is going to the store.

    Good news is, you have time to figure out what is going on and people can play your game ad free for now to figure out if they like it or not.