Why is its not using ( using UnityEngine.Advertisements; )


for some reason it’s not using “using UnityEngine.Advertisements;” and I’m not sure why.

FileNotFoundException: Could not load file or assembly 'UnityEngine.Advertisements, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

Which Unity version and have you switched platform to Android/iOS? Also please check the “Ads doesn’t initialize at all” section of Issues with Ads from Services window? Missing assemblies? - look here which has some troubleshooting steps

/Rasmus

I downloaded the assets that fixed the namespace and errors but now when I run the code and click the button the ad does not show for me. also, I’m using Android.

Any error messages? You are welcome to share the code you are using for showing ads

/Rasmus

using System.Collections;
using System.Collections.Generic;
using UnityEngine.Advertisements;
using UnityEngine;

public class PlayAd : MonoBehaviour {

    public SuperGold rewardgold;

    public void ShowAd(){
        //if (Advertisement.IsReady ()) {
        var options = new ShowOptions(){resultCallback = HandleAdResult};
        Advertisement.Show ("rewardedVideo",  options);
        //}
    }

    private void HandleAdResult(ShowResult result)
    {
        switch (result) {
        case ShowResult.Finished:
            rewardgold.supergold += 2;
            Debug.Log ("Player gains gold");
            break;

        case ShowResult.Skipped:
            //rewardgold.supergold += 2;
            Debug.Log("Player skipped ad");
            break;

        case ShowResult.Failed:
            //rewardgold.supergold += 2;
            Debug.Log ("Player failed to launch the ad,");
            break;
        }
    }
}

it says the ads Failed.