Closed PokerDawg closed 2 years ago
Events aren't invoked from the main thread, so it's not guaranteed that you'll receive any callbacks.
Wrap your callbacks methods with this and it should work.
MobileAdsEventExecutor.ExecuteInUpdate(() =>
{
// Your code
});
Hello @irakli
Changing the AdMobManager.OnInterstitialAdClosed
method from:
void OnInterstitialAdClosed(object sender, System.EventArgs args)
{
LogMessage("Interstitial ad closed");
RequestAndLoadInterstitialAd();
}
... to:
void OnInterstitialAdClosed(object sender, System.EventArgs args)
{
MobileAdsEventExecutor.ExecuteInUpdate(() =>
{
LogMessage("Interstitial ad closed");
RequestAndLoadInterstitialAd();
});
}
... does not solve the issue. I can still reproduce the bug every single time I open the control center immediately after closing the ad.
@PokerDawg I implemented the suggested fix of wrapping the callback handler within ExecuteInUpdate()
. The result looked correct to me (image below). I will be closing this issue, please feel free to reopen if there is something I missed or you are still stuck.
Hello @NVentimiglia
I have wrapped the AdMobManager.LogMessage
method's contents in ExecuteInUpdate()
, like your screenshot, and I am still getting the same result.
Have you managed to reproduce the problem without ExecuteInUpdate()
?
As an aside, if AdMobManager.OnInterstitialAdClosed
looks like this
void OnInterstitialAdClosed(object sender, System.EventArgs args)
{
MobileAdsEventExecutor.ExecuteInUpdate(() =>
{
LogMessage("Interstitial ad closed");
RequestAndLoadInterstitialAd();
});
}
... then does modifying the AdMobManager.LogMessage
method with ExecuteInUpdate()
even do anything? Presumably it's already getting called from an Update()
somewhere, right??
Edit: how do I reopen this issue?
@NVentimiglia This problem is still not solved. Can you reopen this? Or, I can create a new issue.
This problem is still not solved for me too
@PokerDawg I implemented the suggested fix of wrapping the callback handler within
ExecuteInUpdate()
. The result looked correct to me (image below). I will be closing this issue, please feel free to reopen if there is something I missed or you are still stuck.
This problem is still not solved.
[REQUIRED] Step 1: Describe your environment
[REQUIRED] Step 2: Describe the problem
Steps to reproduce:
AdMob Event Issue (2021.2.1).zip
Expected result: the ad closes and the
OnAdClosed
callback is triggered Actual result: the ad closes but theOnAdClosed
callback is NOT triggeredHere are two videos:
Notes and findings:
MonoBehaviour.OnApplicationPause
andMonoBehaviour.OnApplicationFocus
)MobileAds.SetiOSAppPauseOnBackground(true);
does not solve this issue either; the same thing happens and the game remains pausedOnAdClosed
and maybe evenOnUserEarnedReward
with proper timing)