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 ads not showing when i build the game

Discussion in 'Unity Ads & User Acquisition' started by SimonOwned, Sep 11, 2018.

  1. SimonOwned

    SimonOwned

    Joined:
    Sep 25, 2017
    Posts:
    4
    In unity when i press my "adbutton" it shows that everything is working fine
    But when i build the game and export it with xcode on my phone nothing happens.
    Is this normal and when i publish the game there will be ads or am I doing something wrong
    Here is the code:
    Code (CSharp):
    1. public void PlayAd()
    2.     {
    3.         if (secoundChance == true)
    4.         {
    5.             if (Advertisement.IsReady() && rewarded == false)
    6.             {
    7.                 Advertisement.Show("rewardedVideo", new ShowOptions() { resultCallback = HandleAdResult });
    8.             }
    9.         }
    10.     }
    11.     private void HandleAdResult(ShowResult result)
    12.     {
    13.  
    14.         switch (result)
    15.         {
    16.  
    17.             case ShowResult.Finished:
    18.                 rewardPlayer();
    19.                 break;
    20.             case ShowResult.Skipped:
    21.                 Debug.Log("Player did not fully watch the ad");
    22.                 break;
    23.             case ShowResult.Failed:
    24.                 Debug.Log("Ad failedt to watch");
    25.                 break;
    26.         }
    27.  
    28.     }
    it's the first game i'm making so i dont know how to fix it myself
     
  2. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    Hello, @SimonOwned . How do initialize the gameID?