Search Unity

Bug Callbacks not firing on rewarded ads

Discussion in 'Unity Mediation' started by lmbarns, Mar 13, 2023.

  1. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    edit nevermind, ended up using something else instead of mediation.


    The two callbacks for OnLoaded and OnFailedLoad work properly, the ad shows, but none of the other subscribed events get called.

    OnShowed, OnFailedShow, OnUserReward, and OnClosed never get called....

    Unity 2021.3.16f1, latest ads with mediation as of yesterday. Testing on device. Does it matter that the ads are in test mode?

    Code (CSharp):
    1.  
    2.     async Task ShowAd(string adName)
    3.     {
    4.    
    5.         // Instantiate a rewarded ad object with platform-specific Ad Unit ID
    6.         if (Application.platform == RuntimePlatform.Android)
    7.         {
    8.             rewardedAd = MediationService.Instance.CreateRewardedAd(adName);
    9.             // Subscribe callback methods to load events:
    10.             rewardedAd.OnLoaded += AdLoaded;                          //works
    11.             rewardedAd.OnFailedLoad += AdFailedToLoad;          //works
    12.  
    13.             // Subscribe callback methods to show events:
    14.             rewardedAd.OnShowed += AdShown;                         //doesn't work
    15.             rewardedAd.OnFailedShow += AdFailedToShow;        //doesn't work
    16.             rewardedAd.OnUserRewarded += UserRewarded;      //doesn't work
    17.             rewardedAd.OnClosed += AdClosed;                           //doesn't work
    18.         }
    19.         else if (Application.platform == RuntimePlatform.IPhonePlayer)
    20.         {
    21.             rewardedAd = new RewardedAd(iosAdUnitId);        
    22.         }
    23.  
    24.         try
    25.         {
    26.             // Load an ad:
    27.             await rewardedAd.LoadAsync();
    28.  
    29.             if (rewardedAd.AdState == AdState.Loaded)
    30.                 await rewardedAd.ShowAsync();  //ad does show
    31.         }
    32.         catch (Exception e)
    33.         {
    34.             // Here our load failed.
    35.         }
    36.     }
     
    Last edited: Mar 13, 2023
  2. PeterGost

    PeterGost

    Joined:
    Jan 27, 2020
    Posts:
    18
    The same problem here!