How to verify that the user has completed the video on Admob for Unity?

Asked

Viewed 42 times

0

Code:

 using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using GoogleMobileAds.Api;
    using UnityEngine.UI;
    public class AdmobScript : MonoBehaviour
{

   int CoinOld;
   public Text coins;

   public string VideoAdID;
   RewardBasedVideoAd MyRewardVideoAd;

   // Use this for initialization
   void Start ()
   {

      MyRewardVideoAd = RewardBasedVideoAd.Instance;


   }




   public void LoadVideoAd() {

      if (!MyRewardVideoAd.IsLoaded()) {

         AdRequest request = new AdRequest.Builder().Build();

         MyRewardVideoAd.LoadAd(request, VideoAdID);
      }

      }

   public void ShowVideoAd() {

      if (MyRewardVideoAd.IsLoaded())
      {

         MyRewardVideoAd.Show();

      }
      else
      {

         LoadVideoAd();

      }
      }
      public void HandleRewardBasedVideoRewarded(object sender, Reward args)   { 

      CoinOld += 200;
      coins.text = "" + CoinOld;
      }
}
  • Edit your question and enter your question, you only have the code.

  • Read the https://developers.google.com/admob/unity/startAPI documentation

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.