玩家可以观看奖励的广告,但不会获得奖励。 你能帮我解决我的问题吗?
我已多次检查代码。
using UnityEngine.Advertisements;
using UnityEngine;
using UnityEngine.UI;
public void Start()
{
Advertisement.Initialize(GameId);
}
public void ShowRewardedAd()
{
if (Advertisement.IsReady("rewardedVideo"))
{
var options = new ShowOptions { resultCallback = HandleShowResult};
Advertisement.Show("rewardedVideo");
}
}
public static void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("The ad was successfully shown.");
ToReceiveReward = true;
break;
case ShowResult.Skipped:
Debug.Log("The ad was skipped before reaching the end.");
break;
case ShowResult.Failed:
Debug.LogError("The ad failed to be shown.");
break;
}
}
if(ToReceiveReward == true)
{
Debug.Log("receive reward");
MainScript.CurrentCoins += 200;
ToReceiveReward = false;
}
我希望玩家在观看奖励的广告后获得奖励
谢谢Quint van Oorschot