I have this code and after i execute it with a button console everytime prints out that video failed to show. maybe i just don't know how to enable ads in the unity. i have test mode enabled. this is my code. :
private string gameId = "1523603";
void Start(){
Advertisement.Initialize (gameId);
}
public void ShowAd ()
{
var options = new ShowOptions();
options.resultCallback = HandleShowResult;
Debug.Log (Advertisement.IsReady ("rewardedVideo"));
Advertisement.Show(gameId, options);
}
void HandleShowResult (ShowResult result)
{
if(result == ShowResult.Finished) {
Debug.Log("Video completed - Offer a reward to the player");
OnemoreTry ();
}else if(result == ShowResult.Skipped) {
Debug.LogWarning("Video was skipped - Do NOT reward the player");
}else if(result == ShowResult.Failed) {
Debug.LogError("Video failed to show");
}
}
↧