Why does this code keep on repeating ads non stop??
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) {
} }
Your answer
![](https://koobas.hobune.stream/wayback/20220613002212im_/https://answers.unity.com/themes/thub/images/avi.jpg)