После обновления SDK рекламы выводит ошибки

После завершения разработки игры я столкнулся с проблемой. Теперь Google Play поддерживает приложения с уровнем API не ниже 33. Однако из-за устаревшего SDK рекламы игра не запускается после обновления, выводя 4 ошибки.

Assets\Scripts\AdsListener.cs(14,26): error CS1729: 'InterstitialAd' does not contain a constructor that takes 1 arguments

Assets\Scripts\AdsListener.cs(16,20): error CS1061: 'InterstitialAd' does not contain a definition for 'LoadAd' and no accessible extension method 'LoadAd' accepting a first argument of type 'InterstitialAd' could be found (are you missing a using directive or an assembly reference?)

Assets\Scripts\AdsListener.cs(21,23): error CS1061: 'InterstitialAd' does not contain a definition for 'IsLoaded' and no accessible extension method 'IsLoaded' accepting a first argument of type 'InterstitialAd' could be found (are you missing a using directive or an assembly reference?)

Assets\Scripts\AdsListener.cs(29,23): error CS1061: 'InterstitialAd' does not contain a definition for 'IsLoaded' and no accessible extension method 'IsLoaded' accepting a first argument of type 'InterstitialAd' could be found (are you missing a using directive or an assembly refe

Идентификатор рекламы я убрал. Вот код:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;

public class AdsListener : MonoBehaviour
{
  public int nege = 0;
  private InterstitialAd interstitialAd;
  private const string interstitialUnitId = "";

  private void OnEnable()
  {
    interstitialAd = new InterstitialAd(interstitialUnitId);
    AdRequest adRequest = new AdRequest.Builder().Build();
    interstitialAd.LoadAd(adRequest);
  }

  private void Update() 
  {
    if(interstitialAd.IsLoaded() && nege == 0)
    {
        nege += 1;  
    }
  }

  public void ShowAd()
  {
    if(interstitialAd.IsLoaded())
    {
        interstitialAd.Show();  
    }
  }
}

Если надо вот второй код:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;


public class Adsnitiza : MonoBehaviour
{
  private void Start() 
  {
    MobileAds.Initialize(iniStatus => { });
  }
}

И по возможности подскажите какой лучше на данный момент использовать SDK рекламы адмоб.


Ответы (0 шт):