zoneId | Optional zone identifier. If not specified, your default zone specified in the admin settings will be used. |
options | Specify e.g. callback handler to be called when video has finished. |
Show an advertisement in your project.
See Also: IsReady.
#pragma strict public class UnityAdsExample extends MonoBehaviour { public function ShowRewardedAd() { if (Advertisement.IsReady("rewardedVideoZone")) { var options: var = new ShowOptions(); Advertisement.Show("rewardedVideoZone", options); } } private function HandleShowResult(result: ShowResult) { 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; } } }
using UnityEngine; using UnityEngine.Advertisements;
public class UnityAdsExample : MonoBehaviour { public void ShowRewardedAd() { if (Advertisement.IsReady("rewardedVideoZone")) { var options = new ShowOptions { resultCallback = HandleShowResult }; Advertisement.Show("rewardedVideoZone", 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; } } }