Hello, i have a problem with rewarded video ads. I dont see nothing wrong...
My code is:
public void WatchVideoForCoinButtonClick()
{
// avoid multiple click
if (clicking == true) return;
clicking = true;
StartCoroutine(ResetButtonClick());
if (Advertisement.IsReady("rewardedVideo"))
{
var options = new ShowOptions { resultCallback = HandleShowResult };
Advertisement.Show("rewardedVideo", options);
}
else
{
Debug.Log("Unity Ads: Rewarded video is not ready.");
}
}
private void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("Unity Ads: The ad was successfully shown.");
// plus coin
GameData.instance.SavePlayerCoin(GameData.instance.GetPlayerCoin() + Configure.instance.watchVideoCoin);
// play add coin sound
AudioManager.instance.CoinAddAudio();
// update text label
UpdateCoinAmountLabel();
break;
case ShowResult.Skipped:
Debug.Log("Unity Ads: The ad was skipped before reaching the end.");
break;
case ShowResult.Failed:
Debug.LogError("Unity Ads: The ad failed to be shown.");
break;
}
}
↧