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

Unity Ads Not Working?

Discussion in 'Unity Ads & User Acquisition' started by DaRealMik, May 13, 2020.

  1. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    I had Unity Ads all set up and ready to go. I played an ad every time a button was pressed on the Game Over screen. It was working completely fine until I installed Unity 2019.3.13f1. Now it doesn't show the dummy ads and when I connected it to my phone in Unity Remote 5, there were no ads there either. I'm not sure what's happening. Please help.

    My ad code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.SceneManagement;
    3. using UnityEngine.Advertisements;
    4. using UnityEngine.Audio;
    5.  
    6.  
    7. public class GameOverMenu : MonoBehaviour {
    8.  
    9.     public AudioMixer mixer;
    10.  
    11.     void Start()
    12.     {
    13.         Time.timeScale = 1f;
    14.     }
    15.  
    16.  
    17.     public void GoHome()
    18.     {
    19.         SceneManager.LoadScene("Home");
    20.     }
    21.  
    22.     public void PlayAgain()
    23.     {
    24.         SceneManager.LoadScene("MainGame");
    25.     }
    26.    
    27.     public void ShowAds()
    28.     {
    29.         if (Advertisement.IsReady("video"))
    30.         {
    31.             Advertisement.Show("video");
    32.         }
    33.  
    34.         if (Advertisement.isShowing)
    35.         {
    36.             Time.timeScale = 0f;
    37.             mixer.SetFloat("Volume", -80f);
    38.         }
    39.     }
    40.  
    41. }
     
  2. sbankhead

    sbankhead

    Unity Technologies

    Joined:
    Jul 27, 2014
    Posts:
    97
    Are there any console errors or device logs you can share. Overall your script seems fine, other than not initializing, but i'll assume that takes place successfully somewhere else.

    Can you share how your including unity ads in your project, what version of the Ads SDK your using, and any general information to help me remotely troubleshoot you.
     
  3. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    I'm not receiving any console errors. I use the ads when the player clicks play again or home on the game over screen(I'm releasing to the Play Store and my project is on Android). For the SDK, I'll assume you're talking about the package version, which is 3.4.5. About the initalization, I don't think I ever call the function, the only weird part is that I haven't touched my code and before it worked just fine, so I will have to look into that.
     
  4. DaRealMik

    DaRealMik

    Joined:
    Jul 27, 2019
    Posts:
    69
    I got it to work by myself. Turns out all I needed to do was initialize the ads! Thanks for the help anyway!
     
    kyle-unity likes this.