Search Unity

Unity ads work in editor, but do not work on android device

Discussion in 'Unity Ads & User Acquisition' started by leozaur, Apr 17, 2021.

  1. leozaur

    leozaur

    Joined:
    Jan 7, 2018
    Posts:
    22
    How to solve this problem?
    script is here
     

    Attached Files:

  2. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    There are no obvious errors in your code, but it could be that your mainScene property is set to true in the Inspector? This would stop the Ads code initializing.
     
  3. leozaur

    leozaur

    Joined:
    Jan 7, 2018
    Posts:
    22
    yes, but, this works in editor because as you can see bool mainScene is public and i tick to true in not mainScene of the game, problemss seem not to be appearing in code.
     
  4. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    The editor functionality is only a placeholder to help you get a sense of how ads will appear in your game -- you can show these placeholders without initializing the SDK. However, in real builds you must make sure the SDK initializes properly.

    Can you provide a device log from your app running from when it launches to when you try to show an ad?
     
  5. leozaur

    leozaur

    Joined:
    Jan 7, 2018
    Posts:
    22
    if you can explain me how(i am new to android dev)
     
  6. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519