1

我开发了一个应用程序。其中,要访问级别,玩家需要购买或观看奖励视频。要观看奖励视频播放器需要按下或点击按钮。但是当我按下一个按钮时,什么都没有发生!!

我创建了一个文件“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 中介。有标记表示未决。我无法弄清楚问题出在哪里。

在这方面指导我!

4

1 回答 1

0

如果您只使用一个网络来显示奖励视频,您可以简单地使用 Unity ADS SDK 而无需任何中介。我有同样的问题,几个月后我放弃了。我将 Admob 用于横幅/插页式广告,将 UnityAds 用于奖励视频,效果很好。

于 2016-10-27T17:54:03.703 回答