Im getting an error

using UnityEngine;
using UnityEngine.Advertisements;

public class AdManager : MonoBehaviour
{
public string gameID = “your_game_id_here”;
public string rewardedVideoPlacementID = “your_rewarded_video_placement_id”;
public string interstitialPlacementID = “your_interstitial_placement_id”;
public string bannerPlacementID = “your_banner_placement_id”;

private bool isRewardedAdShowing = false;
private bool isInterstitialAdShowing = false;

void Start()
{
    Advertisement.Initialize(gameID, true);
    Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER);
}

public void ShowRewardedAd()
{
    if (!isRewardedAdShowing)
    {
        isRewardedAdShowing = true;
        Advertisement.Show(rewardedVideoPlacementID);
    }
}

public void ShowInterstitialAd()
{
    if (!isInterstitialAdShowing)
    {
        isInterstitialAdShowing = true;
        Advertisement.Show(interstitialPlacementID);
    }
}

public void ShowBannerAd()
{
    Advertisement.Banner.Show(bannerPlacementID);
}

public void HideBannerAd()
{
    Advertisement.Banner.Hide();
}

private void OnEnable()
{
    Advertisement.AddListener(new UnityAdsListener());
}

private void OnDisable()
{
    Advertisement.RemoveListener(new UnityAdsListener());
}

private class UnityAdsListener : IUnityAdsListener
{
    public void OnUnityAdsReady(string placementId)
    {
        // Ad is ready, handle the event if needed
    }

    public void OnUnityAdsDidError(string message)
    {
        // Ad encountered an error, handle the event if needed
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Ad has started, handle the event if needed
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        if (placementId == rewardedVideoPlacementID && isRewardedAdShowing)
        {
            isRewardedAdShowing = false;

            if (showResult == ShowResult.Finished)
            {
                // The user watched the rewarded ad completely
                // Implement your reward logic here
            }
            else if (showResult == ShowResult.Skipped)
            {
                // The user skipped the rewarded ad
            }
            else if (showResult == ShowResult.Failed)
            {
                // The rewarded ad failed to show
            }
        }
        else if (placementId == interstitialPlacementID && isInterstitialAdShowing)
        {
            isInterstitialAdShowing = false;

            if (showResult == ShowResult.Finished)
            {
                // The user watched the interstitial ad completely
            }
            else if (showResult == ShowResult.Skipped)
            {
                // The user skipped the interstitial ad
            }
            else if (showResult == ShowResult.Failed)
            {
                // The interstitial ad failed to show
            }
        }
    }
}

}
The error is Assets\NewBehaviourScript.cs(58,38): error CS0246: The type or namespace name ‘IUnityAdsListener’ could not be found (are you missing a using directive or an assembly reference?)

@MridulGames - I apologize for the delay in response, I seem to be the only active moderator these days, and I am trying to keep up, but I have been very busy lately.

The error you’re encountering is because the namespace IUnityAdsListener is not recognized. This interface is a part of the UnityEngine.Advertisements namespace and it’s used to handle the events from Unity Ads.

If you’re using the correct namespace and still getting the error, it might be that the Unity Ads package is not installed correctly or you are not using the correct version of the Unity Ads SDK that contains IUnityAdsListener.

Here’s a list of things you can do to try and solve the issue:

1. Check Unity Ads SDK Version

Ensure that you are using a version of the Unity Ads SDK that contains IUnityAdsListener. As of my knowledge cutoff in September 2021, you should be using Unity Ads SDK 3.0 or later.

2. Check Unity Ads Package

In the Unity Editor, navigate to Window → Package Manager, and check if the Unity Ads package is installed. If not, install it.

3. Check Namespaces

Ensure that you have included the necessary UnityEngine.Advertisements namespace in your script.

4. Check Interface Implementation

The UnityAdsListener class should implement the IUnityAdsListener interface like this: private class UnityAdsListener : IUnityAdsListener

example:

using UnityEngine;
using UnityEngine.Advertisements;

And here is how your UnityAdsListener class declaration should look:

private class UnityAdsListener : IUnityAdsListener
{
    // your methods here
}

If none of these solutions work, there might be another underlying issue. In that case, let us know so we can provide more help.