Search Unity

Ads never ready in Editor

Discussion in 'Unity Ads' started by JeremiahHP, Oct 2, 2016.

  1. JeremiahHP

    JeremiahHP

    Joined:
    Apr 12, 2014
    Posts:
    6
    Can someone help me with this problem?

    I'm testing unity ads in the editor and it seems as though the ads are never ready to show.
    I have a working Internet connection, I have a account with the ads setup. <See "AppInfo.jpg" bellow>

    Code (CSharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using UnityEngine.Advertisements;
    5. using System.Collections;
    6.  
    7. public class AdManager : MonoBehaviour
    8. {
    9.     void Start()
    10.     {
    11.         //Advertisement.Initialize(1156726, true);
    12.     }
    13.  
    14.     public void ShowAd()
    15.     {
    16.         StartCoroutine(ShowAdWhenReady());
    17.  
    18.         Debug.Log("Ad was called! ");
    19.  
    20.  
    21.     }
    22.  
    23.     IEnumerator ShowAdWhenReady()
    24.     {
    25.         while (!Advertisement.IsReady())
    26.         {
    27.             yield return null;
    28.             Debug.Log("Ad not readyn! ");
    29.  
    30.         }
    31.  
    32.         Advertisement.Show();
    33.     }
    34. }
    the debug result for this is in image "DebugLog.jpg" below

    I'm using Unity Ads Service, so I wont need the store plug in from the store,
    This code is attached to the Button I want to show the ad on, the public function 'ShowAd()' is called from the button i want to use to start the ad

    Note: This is my first time asking a question on a problem I have on this forum so if I leave out any important info just let me know.
     

    Attached Files:

    Last edited: Oct 2, 2016
  2. JeremiahHP

    JeremiahHP

    Joined:
    Apr 12, 2014
    Posts:
    6
    Solved!

    but for anyone who has this problem.

    when testing ads make sure that you go to Build Settings then Platform and set your platform to either Android or IOS,
    mine was set to Windows..

    so if you're developing a app for android and testing your ads make sure the platform is set to android even in testing.
     
    OjinCZ likes this.
unityunity