Hello, I was working through the mobile course, and noticed that I have certain errors, and I am assuming that they have something to do with my Ads package
The errors are that the IUnityAdsListener is highlighted(about the 5th line down), and the Adlistener part is highlighted too
I am assuming this is because of my ads package because All I have in my package manager is the Advertisements Legacy, and the Advertisements Mediation…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class AdManager : MonoBehaviour, IUnityAdsListener
{
[SerializeField] private bool testMode = true;
public static AdManager Instance;
private GameOverHandler gameOverHandler;
#if UNITY_ANDROID
private string gameId = “5216947”;
#elif UNITY_IOS
private string gameId = “5216946”;
#endif
void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
Advertisement.AdListener(this);
Advertisement.Initialize(gameId, testMode);
}
}
public void ShowAd(GameOverHandler gameOverHandler)
{
this.gameOverHandler = gameOverHandler;
Advertisement.Show("rewardedVideo");
}
public void OnUnityAdsDidError(string message)
{
Debug.LogError($"Unity Ads Error{message}");
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
switch(showResult)
{
case ShowResult.Finished:
gameOverHandler.ContinueGame();
break;
case ShowResult.Skipped:
//Ad was skipped
break;
case ShowResult.Failed:
Debug.LogWarning("Ad Failed");
break;
}
}
public void OnUnityAdsDidStart(string placementId)
{
Debug.Log("Ads Started");
}
public void OnUnityAdsReady(string placementId)
{
Debug.Log("Unity Ads Ready");
}
}