Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

OnUnityAdsShowComplete doesn't trigger, why?

$
0
0
[SerializeField] string _androidGameId; [SerializeField] string _iOSGameId; string _gameId; [SerializeField] bool _testMode = true; private void Awake() { if (Advertisement.isInitialized) { Debug.Log("Advertisement is Initialized"); LoadRewardedAd(); } else { InitializeAds(); } } public void InitializeAds() { _gameId = (Application.platform == RuntimePlatform.IPhonePlayer) ? _iOSGameId : _androidGameId; Advertisement.Initialize(_gameId, _testMode, this); } public void OnInitializationComplete() { Debug.Log("Unity Ads initialization complete."); LoadInerstitialAd(); } public void OnInitializationFailed(UnityAdsInitializationError error, string message) { Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}"); } public void LoadInerstitialAd() { Advertisement.Load("Interstitial_Android", this); } public void LoadRewardedAd() { Advertisement.Load("Rewarded_Android", this); } public void OnUnityAdsAdLoaded(string placementId) { Debug.Log("OnUnityAdsAdLoaded"); Advertisement.Show(placementId, this); } public void OnUnityAdsFailedToLoad(string placementId, UnityAdsLoadError error, string message) { Debug.Log($"Error showing Ad Unit {placementId}: {error.ToString()} - {message}"); } public void OnUnityAdsShowFailure(string placementId, UnityAdsShowError error, string message) { Debug.Log("OnUnityAdsShowFailure"); } public void OnUnityAdsShowStart(string placementId) { Debug.Log("OnUnityAdsShowStart"); Time.timeScale = 0; } public void OnUnityAdsShowClick(string placementId) { Debug.Log("OnUnityAdsShowClick"); } public void OnUnityAdsShowComplete(string placementId, UnityAdsShowCompletionState showCompletionState) { Debug.Log("OnUnityAdsShowComplete " + showCompletionState); if (placementId.Equals("Rewarded_Android") && UnityAdsShowCompletionState.COMPLETED.Equals(showCompletionState)) { Debug.Log("rewared Player"); } Time.timeScale = 1; } When I am close to ad the if statement which is inside the OnUnityAdsShowComplete must be triggered but it is not working.

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>