G
G
greedile2021-12-28 19:16:43
Unity
greedile, 2021-12-28 19:16:43

UnityAds not working. Why?

I started making UnityAds, no matter what I do, it doesn't work. ShowInterstitialAd is not a built-in method for some reason, and IsReady is missing altogether. Help me please.

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

public class AdsManager : MonoBehaviour
{
    public string GameID;

    public bool GameTest = true;
    private void Start()
    {
        Advertisement.Initialize(GameID, GameTest);
    }

    public static void ShowInterstitialAd()
    {
        var options = new ShowOptions();

        if (Advertisement.isInitialized)
        {
            Advertisement.Show("rewardedVideo", options);
        }
        else
        {
            Debug.Log("Try again");
        }
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
namee, 2021-12-29
@namee

for the class, implement the interfaces IUnityAdsLoadListener, IUnityAdsShowListener
run Advertisement.Load(placementID, this);
and implement the method public void OnUnityAdsAdLoaded(string placementId)
and in other things, as far as I remember, this is in the official examples

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question