我开发了一款应用。其中,要获得访问级别,玩家需要购买或观看奖励视频。要观看奖励的视频播放器需要按或点击按钮。但是当我按下按钮时,什么都没发生!!
我创建了一个文件" AdManager.cs"代码如下:
public class AdManager : MonoBehaviour {
// before codes
.
.
.
//I have created an instance to admanager
public static AdManager Instance {set;get;}
.
.
.
.
void Awake(){
Instance=this;
}
.
.
.
.
//few more codes
.
.
.
public void showRewardBasedVideoAd(){
#if UNITY_ANDROID
string adUnitId = "xxxxxxxxxxxxxxxxxxxxxxx";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
rewardBasedVideoAd = RewardBasedVideoAd.Instance;
rewardBasedVideoAd.OnAdLoaded += HandleOnrewardBasedVideoAdLoaded;
rewardBasedVideoAd.OnAdFailedToLoad += HandleOnrewardBasedVideoAdFailedToLoad;
rewardBasedVideoAd.OnAdOpening += HandleOnrewardBasedVideoAdOpening;
rewardBasedVideoAd.OnAdRewarded += HandleOnrewardBasedVideoAdRewarded;
rewardBasedVideoAd.OnAdClosed += HandleOnrewardBasedVideoAdClosed;
rewardBasedVideoAd.OnAdLeavingApplication += HandleOnrewardBasedVideoAdLeavingApplication;
AdRequest request = new AdRequest.Builder ().Build();
rewardBasedVideoAd.LoadAd (request, adUnitId);
if (rewardBasedVideoAd.IsLoaded ()) {
rewardBasedVideoAd.Show ();
} else {
Debug.Log ("Rewarded Video Ad is not Yet ready!!!!");
}
}
public void HandleOnrewardBasedVideoAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
print("Interstitial Failed to load: " + args.Message);
}
public void HandleOnrewardBasedVideoAdLoaded(object sender, EventArgs args)
{
print("OnAdLoaded event received.");
}
public void HandleOnrewardBasedVideoAdOpening(object sender, EventArgs args)
{
print("OnAdLoaded event received.");
}
public void HandleOnrewardBasedVideoAdClosed(object sender, EventArgs args)
{
print("OnAdLoaded event received.");
}
public void HandleOnrewardBasedVideoAdLeavingApplication(object sender, EventArgs args)
{
print("OnAdLoaded event received.");
}
public void HandleOnrewardBasedVideoAdRewarded(object sender, Reward args)
{
string type = args.Type;
double amount = args.Amount;
print("User rewarded with: " + amount.ToString() + " " + type);
totalPoints += 100;
Debug.Log("100granted");
}
// rest codes
}
我正在开发这个应用程序的统一和Android平台。 我在admob奖励视频adunit部分创建了unityad中介。有标记说待定。我无法弄清问题在哪里。
在这方面指导我!!
答案 0 :(得分:0)
如果您只使用一个网络来显示激励视频,则可以直接使用Unity ADS SDK而无需任何调解。 我有同样的问题,几个月后我放弃了。我将Admob用于横幅广告/插页式广告,UnityAds用于奖励视频,并且它的工作效果很好。