I put Admob rewarded video ads to my unity game and it works, i can see the video in my phone. The only problem is that i cant control the rewarded video events, I tried to do that when a player finishes to watch the video he will get more coins and also that the video ad button wont be activated:
public void HandleRewardBasedVideoRewarded(object sender, Reward args)
{
videoButton.SetActive(false);
valueScore += PlayerPrefs.GetInt("Currency");
PlayerPrefs.SetInt("Currency", valueScore);
alreadyShowedVideo = true;
gotCoinsText.text = "You got more coins!";
}
btw I also put the handlers in Start function
void Start()
{
this.rewardBasedVideo = RewardBasedVideoAd.Instance;
this.rewardBasedVideo.OnAdLoaded += this.HandleRewardBasedVideoLoaded;
this.rewardBasedVideo.OnAdFailedToLoad += this.HandleRewardBasedVideoFailedToLoad;
this.rewardBasedVideo.OnAdOpening += this.HandleRewardBasedVideoOpened;
this.rewardBasedVideo.OnAdStarted += this.HandleRewardBasedVideoStarted;
this.rewardBasedVideo.OnAdRewarded += this.HandleRewardBasedVideoRewarded;
this.rewardBasedVideo.OnAdClosed += this.HandleRewardBasedVideoClosed;
this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;
}
For some reason when i finish watching the video I dont get more coins and I can still see the video button.
Edit: I sovled my problem by adding this to the script:
public event EventHandler OnAdLoaded;
public event EventHandler OnAdFailedToLoad;
public event EventHandler OnAdOpening;
public event EventHandler OnAdStarted;
public event EventHandler OnAdClosed;
public event EventHandler OnAdRewarded;
public event EventHandler OnAdLeavingApplication;
↧