Search Unity

Enable built-in ads extension with Advertisement from Package Manager?

Discussion in 'Unity Ads & User Acquisition' started by nemeth-regime, May 20, 2021.

  1. nemeth-regime

    nemeth-regime

    Joined:
    Feb 13, 2017
    Posts:
    40
    Do I need to enable built-in ads extension from the services window when I am using the Advertisement plugin from Package Manager?

    I ask because I get a pop-up in the services window saying "To continue using unity ads in your project, please import the latest Unity ads plugin from the Asset Store, or re-enable the internal ads extension under the Advanced settings below."

    About 2 weeks ago I updated from the Asset stores Monetization plugin (3.6.0) to the Advertisement plugin (3.7.1) in package manager and since then I have not seen 1 banner ad so just trying to figure out what is wrong.

    Unity 2019.4.18
    Advertisement 3.7.1
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @millar5001

    In 2019.4, when you enable the Ads service, version 3.4.7 of the Advertisement Package is imported. (Doesn't look like this is accurately reflected in the Package Manager UI.)

    I don't think the "Enable built-in Ads extension" has any effect in 2019.x. Before Package Manager, it would allow you to use the Service window with the Asset Store version of the Ads package. However, that's no longer necessary, as the Asset Store version is deprecated now.

    Since you are migrating from the Asset Store package to the Package Manager package, I would make sure that you have removed all remnants of the Monetization package. This can sometimes lead to unexpected behavior.

    If you implement banners using the BannerLoadOptions, you get better insight into why banners are not showing.

    Code (CSharp):
    1. string placement = "banner";
    2. public void LoadBanner()
    3. {
    4.     //Note: Banner.SetPosition can only be called once per session.
    5.     // It should be called before Load or Show to prevent issues.
    6.     //Advertisement.Banner.SetPosition(BannerPosition.CENTER);
    7.     if(!Advertisement.Banner.isLoaded)
    8.     {
    9.         BannerLoadOptions loadOptions = new BannerLoadOptions
    10.         {
    11.             loadCallback = OnBannerLoaded,
    12.             errorCallback = OnBannerError
    13.         };
    14.         Advertisement.Banner.Load(placement, loadOptions);
    15.     }
    16. }
    17. void OnBannerLoaded()
    18. {
    19.     Debug.Log("Banner Loaded");
    20.     Advertisement.Banner.Show(placement);
    21. }
    22. void OnBannerError(string error)
    23. {
    24.     Debug.Log("Banner Error: " + error);
    25. }