登录后复制
using UnityEngine;using UnityEngine.Advertisements; public class UnityAdsExample : MonoBehaviour{ public void ShowRewardedAd() { if (Advertisement.IsReady("rewardedVideo")) { var options = new ShowOptions { resultCallback = HandleShowResult }; Advertisement.Show("rewardedVideo", options); } } private void HandleShowResult(ShowResult result) { switch (result) { case ShowResult.Finished: Debug.Log("The ad was successfully shown."); // // YOUR CODE TO REWARD THE GAMER // Give coins etc. 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; } }}1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.
登录后复制
private void HandleShowResult (ShowResult result) if (result == ShowResult.Finished) //判断广告是否被看完 { //Add code to reward your player here! //Give coins, etc }1.2.3.4.5.6.
首先登录 Unity Ads Dashboard 使用UDN账户,并选择你的游戏项目。
选择平台.
从这里,您可以修改位置和其他特定于游戏的设置。
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删