Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Unity Ads not working all of a sudden

Discussion in 'Unity Ads' started by Cross_J, Feb 2, 2017.

  1. Cross_J

    Cross_J

    Joined:
    Oct 10, 2013
    Posts:
    5
    Hi guys,

    So I remember in the weekend my project's ad function working and for some reason now I can't seem to get it to work all of a sudden... I even tried nuking my project (archiving it), and re-adding it but still doesn't work.

    The current code I have is as per follows :

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.SceneManagement;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class Button : MonoBehaviour {
    7.    
    8.     #if !UNITY_ADS
    9.     private string gameId;
    10.     public bool enableTestMode = true;
    11.     #endif
    12.  
    13.     IEnumerator Start(){
    14.         #if !UNITY_ADS // If the Ads service is not enabled...
    15.         if (Advertisement.isSupported) { // If runtime platform is supported...
    16.         Advertisement.Initialize(gameId, enableTestMode); // ...initialize.
    17.         }
    18.         #endif
    19.  
    20.         // Wait until Unity Ads is initialized,
    21.         //  and the default ad placement is ready.
    22.         while (!Advertisement.isInitialized || !Advertisement.IsReady()) {
    23.             yield return new WaitForSeconds(0.5f);
    24.         }
    25.  
    26.         // Show the default ad placement.
    27.         Advertisement.Show();
    28.  
    29.     }
    30.  
    31.     public void changeScene (string str){
    32.         Application.LoadLevel (str);
    33.     }
    34.  
    35. }
    36.  
    This code bit used to work for me, but now it doesn't. I've also tried initialising the Ad manuall like
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.SceneManagement;
    4. using UnityEngine.Advertisements;
    5.  
    6. public class Button : MonoBehaviour {
    7.    
    8.     IEnumerator Start(){
    9.         Advertisement.Initialize("123456", true); // ...initialize.
    10.  
    11.         while (!Advertisement.isInitialized || !Advertisement.IsReady()) {
    12.             yield return new WaitForSeconds(0.5f);
    13.         }
    14.  
    15.         Advertisement.Show();
    16.  
    17.     }
    18.  
    19.     public void changeScene (string str){
    20.         Application.LoadLevel (str);
    21.     }
    22.  
    23. }
    24.  
    but same story, and also tried with the start function as a void and with the waitsec part gone although I really shouldn't do that part.

    The problem is that there are no errors or warning but just the Ad (the blue an ad should be here screen) never loads on the editor, nor on an adroid device.

    I'm currently using unity 5.50f3, using the Unity Ad via services, not through assests, and my project is set so it's an Android build.
     
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    Cross_J likes this.
  3. Cross_J

    Cross_J

    Joined:
    Oct 10, 2013
    Posts:
    5
    Thanks mikai,
    This helped my out a lot. But at the same time I was wandering if the issue has/ or is schduled to be fixed anytime soon?
    Since the integrated Ad function in the services is such a convenient feature.
    I do use the unity ad from the Asset store now but time to time I get an error saying that I've defined "ShowResults" more than once and I think it's to do with me fiddling around with the settings but not too sure...
    Would help a lot to get the easy option back ;)