I Need The Results Of Video ad (skipped,finished or failed)
here Is My Ad Script:
using System;
using UnityEngine;
using UnityEngine.Advertisements;
public class Ads : MonoBehaviour {
void Start() {
if (Advertisement.isSupported) {
Advertisement.Initialize ("66815");
}
if (Advertisement.IsReady ()) {
Advertisement.Show ();
}
}
}
As the link shows, you can put anything into the callback function so that it is called when we have the result of whether the ad Failed, Skipped or Finished:
...
string adResult;
float start = Time.time;
Advertisement.Show(null, new ShowOptions {resultCallback = result => {
adResult = result.ToString();
Debug.Log(adResult);
//Do something else once we know what's happened
//Call some function
DoSomething();
//try again if failed?
if(adResult == "Failed"){
TryAgain();
}
//Add some ingame value if advert watched
if(adResult == "Finished"){
Debug.Log("Yay, they watched the whole thing!");
AddIngameMoney(Mathf.FloorToInt(Time.time-start)); //add money based on length of ad?
}
}
});
...