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

Mobads rewarded don't reward the player

$
0
0
I have got a strange issue. I've implemented an ad code to the my game and when my player dies, im asking that the player would watch the ad and reborn. When i build and install the apk to my phone, in first play everything works very well. After second attemp, my rewarderAdd.OnAdRewarded function is not working at all. Im controlling the ad state in the game and in second play, i can see that the reward system is not functionning. But when i restart my game its work for once more time and the second attemp, its failing again. Its don't change the ad state so it can't get in to reward function. here is my code private RewardBasedVideoAd rewardedAd; void Start() { adState = 0; gameOverScript = GameObject.Find("GameOver").GetComponent(); kingSCript = GameObject.FindGameObjectWithTag("Player").GetComponent(); isCompleted = false; RequestRewardedVideo(); this.rewardedAd.OnAdRewarded += RewardPlayer; // this.rewardedAd.OnAdClosed += PlayerClosed; } public void RequestRewardedVideo() { rewardedAd = RewardBasedVideoAd.Instance; // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the rewarded ad with the request. this.rewardedAd.LoadAd(request,rewarderID); if(rewardedAd.IsLoaded() == true) { adState = 5; } } private void RewardPlayer(object sender, EventArgs e) { isCompleted = true; adState = 1; RequestRewardedVideo(); Reward(); } private void PlayerClosed(object sender, EventArgs e) { RequestRewardedVideo(); if(adState != 1) { adState = -1; } } public void Reward() { adState = 1; kingSCript.Reborn(); } public void ShowVideoRewardAd() { if (this.rewardedAd.IsLoaded()) { adState = 2; isLoaded = true; this.rewardedAd.Show(); } else { isLoaded = false; } }

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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