Search Unity

Do I need to release my game on Google play store to show ad?

Discussion in 'Unity Ads & User Acquisition' started by LoliSlayer, Nov 17, 2017.

  1. LoliSlayer

    LoliSlayer

    Joined:
    Nov 16, 2017
    Posts:
    2
    Hi all, I have only started learning to use unity for game development.
    I am making a game for android platform and I have followed the following links in making a button to show ad:

    https://unityads.unity3d.com/help/monetization/integration-guide-unity
    https://docs.unity3d.com/ScriptReference/Advertisements.Advertisement.Show.html

    I have enabled test mode on the editor and it worked (the test ad said everything was working correctly).

    But when testing the game on my actual game, the button that shows ad doesn't work. What I mean by doesn't work is I'm not seeing ad popping up.

    Do I first have to publish my game to Google Play store before ad video shows or was there something I missed?
    And must I leave the test mode on or off when I publish it on Play store?

    Thank you.
     
    i-am-developer-9 likes this.
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    Hi,

    You don't need to publish your game in the store for Ads to work.

    Can you post here your code responsible for handling Unity Ads?
     
  3. LoliSlayer

    LoliSlayer

    Joined:
    Nov 16, 2017
    Posts:
    2
    Hi, mikaisomaa.
    Thank you for replying.

    Here's is my code responsible for showing ad:
    Button ad_Button;

    public string placementID = "ShowAdVid";


    void Start()
    {
    Advertisement.Initialize (gameId);

    ad_Button = GetComponent<Button> ();

    if (ad_Button)
    {
    ad_Button.onClick.AddListener (showAd);
    }
    }


    void showAd()
    {
    while (!Advertisement.IsReady ())
    {
    Debug.Log ("Waiting for Ad to be ready");
    }

    Advertisement.Show ();
    }

    I attached this script to a button, my idea is the same as the ones I saw in the document.
    I expected to see an ad showing when I pressed the said button.

    I also included the following at the top of the script
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.Advertisements;
     
  4. lagzilajcsi

    lagzilajcsi

    Joined:
    Jan 19, 2020
    Posts:
    9
    having the same issue, have you resolved it?
     
    Kian1113 likes this.
  5. Pabbe

    Pabbe

    Joined:
    Jun 5, 2018
    Posts:
    1
    Having the same issue. Please help if someone have fixed.
     
    Kian1113 likes this.
  6. Kian1113

    Kian1113

    Joined:
    Sep 13, 2020
    Posts:
    1
    i have same isssue please help anyone please
     
  7. dydhiman16

    dydhiman16

    Joined:
    Sep 26, 2020
    Posts:
    2
    I also have the same problem. Even my code is very basic; I was going to write more advance code but even this small code didn't work so I stopped;. My code-

    using UnityEngine;
    using UnityEngine.Advertisements;

    public class ads : MonoBehaviour
    {
    string id = "3839051";

    void Start()
    {
    Advertisement.Initialize(id, false);
    }

    public void showad()
    {
    Advertisement.Show();
    }


    }
    }[/code]
     
  8. dydhiman16

    dydhiman16

    Joined:
    Sep 26, 2020
    Posts:
    2
    Pls reply
     
  9. i-am-developer-9

    i-am-developer-9

    Joined:
    Jul 29, 2020
    Posts:
    5
    @
    1. dydhiman16
    2. You had not added if(Advertisement.IsReady()).
    3. You can write it as this
      Code (CSharp):
      1. public void showad()
      2. {
      3.       if(Advertisment.IsReady())
      4.       {
      5.              Advertisement.Show();
      6.       }
      7. }
    4. I have also this problem that ads are working in unity editor but not in android device. Maybe it will work for you. try this at least one time