Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Advertisement cannot be initialized

Discussion in 'Unity Ads & User Acquisition' started by Nudeldudel, Jun 5, 2020.

  1. Nudeldudel

    Nudeldudel

    Joined:
    Nov 6, 2019
    Posts:
    2
    Hey all,
    I currently have problems with Unity Advertisement. A few weeks ago, I integrated Advertisement into my game, and I built it for testing on my phone, but if I start the game ads appear immediately (this is not supposed to happen). I tried to fix it and after weeks of frustrating I found out that Advertisement never initialized properly. I searched many forums, but nothing worked for me and they hadn’t the same issue. In previous games I used Monetization, so I tested it, and there were no problems with initialization.

    Code (CSharp):
    1. private void Initialize()
    2.     {
    3.         Advertisement.Initialize(gameId, false);
    4.  
    5.         Monetization.Initialize(gameId, false);
    6.  
    7.         Debug.Log("Monetization initialized: " + Monetization.isInitialized + " , Advertisement initialized: " + Advertisement.isInitialized);
    8.     }
    The debug log is: "Monetization initialized: True , Advertisement initialized: False".

    I don't know what I'm doing wrong. I would just use Monetization, but unfortunately, it's deprecated.
    If anyone has an idea or a solution, I would be very grateful.
     
  2. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    If you have both the Advertisement and Monetization libraries loaded at the same time, that's going to cause some weird issues for sure.

    I'd recommend you remove all your current ads plugins and start over with version 3.4.6 of the Advertisements package from the Package Manager or Asset Store. Then follow our integration guide to make sure all your code is correct:
    https://unityads.unity3d.com/help/unity/integration-guide-unity
     
    Nudeldudel likes this.
  3. Nudeldudel

    Nudeldudel

    Joined:
    Nov 6, 2019
    Posts:
    2
    Hi, Thanks for your answer. Of course, not both libraries were loaded, that was just to test if Monetization is going to be initialized.
    I removed Advertisement and Monetization and use now the latest available version (3.4.5 for me) of Advertisement and it works perfectly.
    But I also unlinked my project and linked it to a new one, maybe my old GameId was corrupt somehow?

    However, thank you very much for your help! :)
     
    Last edited: Jun 8, 2020