Remove isLoading and use UnityExtendedDelegate for show only
Remove isLoading and use UnityExtendedDelegate for show only
MODIFY
adapters/Unity/UnityAdapter/GADMUnityInterstitialAd.m
adapters/Unity/UnityAdapter/GADMUnityInterstitialAd.m
[[GADMAdapterUnity alloc] initializeWithGameID: _gameID withInitDelegate:Nil];
}
- _isLoading = YES;
- [UnityAds addDelegate:self];
[UnityAds load:_placementID loadDelegate:self];
}
return;
}
- [strongConnector adapterWillPresentInterstitial:strongAdapter];
if ([UnityAds isReady:_placementID]) {
+ [UnityAds addDelegate:self];
+ [strongConnector adapterWillPresentInterstitial:strongAdapter];
[UnityAds show:rootViewController placementId:_placementID];
+ } else {
+ return;
}
}
[UnityAds removeDelegate:self];
id<GADMAdNetworkConnector> strongNetworkConnector = _connector;
id<GADMAdNetworkAdapter> strongAdapter = _adapter;
- if (!_isLoading) {
- // Unity Ads show error will only happen after the ad has been loaded. So, we will send
- // dismiss/close callbacks.
+
if (error == kUnityAdsErrorShowError) {
if (strongNetworkConnector && strongAdapter) {
[strongNetworkConnector adapterWillDismissInterstitial:strongAdapter];
[strongNetworkConnector adapterDidDismissInterstitial:strongAdapter];
}
}
- return;
- }
-
- NSError *errorWithDescription = GADUnityErrorWithDescription(message);
- if (strongNetworkConnector && strongAdapter) {
- [strongNetworkConnector adapter:strongAdapter didFailAd:errorWithDescription];
- }
- _isLoading = NO;
}
- (void)unityAdsDidStart:(nonnull NSString *)placementId {
#pragma mark - UnityAdsLoadDelegate Methods
- (void)unityAdsAdFailedToLoad:(nonnull NSString *)placementId {
- [UnityAds removeDelegate:self];
id<GADMAdNetworkConnector> strongConnector = _connector;
id<GADMAdNetworkAdapter> strongAdapter = _adapter;
if (strongConnector && strongAdapter) {
- (void)unityAdsAdLoaded:(nonnull NSString *)placementId {
id<GADMAdNetworkConnector> strongNetworkConnector = _connector;
id<GADMAdNetworkAdapter> strongAdapter = _adapter;
- if (!_isLoading) {
- return;
- }
+
if (strongNetworkConnector && strongAdapter) {
[strongNetworkConnector adapterDidReceiveInterstitial:strongAdapter];
}
- _isLoading = NO;
}
@end

Remove isLoading and use UnityExtendedDelegate for show only

Remove isLoading and use UnityExtendedDelegate for show only