Unity广告,视频始终无法显示

时间:2017-08-27 10:09:50

标签: c# unity3d unity2d

我有这个代码,每次打印出该视频后,我都会用按钮控制台执行它,但它失败了。也许我只是不知道如何在Unity中启用广告。我启用了测试模式。这是我的代码。 :

FIXED 我只需要替换此行

  

public string placementId =“rewardedVideo”;

用这个:

  

Advertisement.Show(placementId,options);

私人字符串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");
    }
}

0 个答案:

没有答案