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

Why does this code keep on repeating ads non stop??

$
0
0
Why does this code keep on repeating ads non stop?? Code link: https://pastebin.com/yRMDKFJR The code: using UnityEngine; using UnityEngine.Advertisements; public class RewardAd : MonoBehaviour, IUnityAdsListener { string gameId = "******"; string myPlacementId = "rewardedVideo"; bool testMode = false; // Initialize the Ads listener and service: public void StartAD() //this function starts when the button is pressed. { Advertisement.AddListener(this); Advertisement.Initialize(gameId, testMode); } // Implement IUnityAdsListener interface methods: public void OnUnityAdsDidFinish(string placementId, ShowResult showResult) { // Define conditional logic for each ad completion status: if (showResult == ShowResult.Finished) { // Reward the user for watching the ad to completion. } else if (showResult == ShowResult.Skipped) { // Do not reward the user for skipping the ad. } else if (showResult == ShowResult.Failed) { Debug.LogWarning("The ad did not finish due to an error."); } } public void OnUnityAdsReady(string placementId) { // If the ready Placement is rewarded, show the ad: if (placementId == myPlacementId) { Advertisement.Show(myPlacementId); } } public void OnUnityAdsDidError(string message) { } public void OnUnityAdsDidStart(string placementId) { } }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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