Search Unity

ADS are not working

Discussion in 'Unity Ads & User Acquisition' started by adeogo172, Jan 25, 2019.

  1. adeogo172

    adeogo172

    Joined:
    Dec 28, 2018
    Posts:
    22
    so i made a button that shows up after i die saying watch ad. this is the script i used:
    using System.Collections;
    using UnityEngine.Advertisements;
    using UnityEngine;

    public class PlayAd : MonoBehaviour
    {
    public void ShowAd()
    {
    if (Advertisement.IsReady())
    {
    Advertisement.Show ("rewardedVideo", new ShowOptions() { resultCallback = HandleAdResult; });
    }
    }

    private void HandleAdResult(ShowResult result)
    {
    switch (result)
    {
    case ShowResult.Finished:
    Debug.Log("Player gains +5 score");
    break;
    case ShowResult.Skipped:
    Debug.Log("Player did not fully watch ad");
    break;
    case ShowResult.Failed:
    Debug.Log("Player failed to launch ad");
    break;
    }
    }
    }


    but it doesnt work when i try to play it. p.s ive turned on unity ads
    how do i make it work
     
    Last edited: Jan 26, 2019
  2. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
  3. adeogo172

    adeogo172

    Joined:
    Dec 28, 2018
    Posts:
    22