Is that normal to receive it 5 times instead of one?
using UnityEngine;
using UnityEngine.Advertisements;
public class AdManager : MonoBehaviour, IUnityAdsListener
{
[SerializeField] private bool testMode = true;
public static AdManager Instance;
#if UNITY_ANDROID
private string gameId = "47***99";
#elif UNITY_IOS
private string gameId = "47***98";
#endif
private GameOverHandler gameOverHandler;
void Awake() {
if(Instance != null && Instance !=this)
{
Destroy(gameObject);
}
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
Advertisement.AddListener(this);
Advertisement.Initialize(gameId, testMode);
}
}
public void ShowAd(GameOverHandler gameOverHandler)
{
this.gameOverHandler = gameOverHandler;
Advertisement.Show("Rewarded_Video");
}
public void OnUnityAdsDidError(string message)
{
Debug.Log($"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.LogError("Ad Failed");
break;
}
}
public void OnUnityAdsDidStart(string placementId)
{
Debug.Log("Ad Started");
}
public void OnUnityAdsReady(string placementId)
{
Debug.Log("Ads Ready");
}
}