Ad is ready it completely work fine on editor but it is not working on phone. I also try to use test mode but not working. My id is correct. Ad is on ,extension is also ad. I also restart, reinstall the plugin. I try in every possible way I get from Internet but nothing works.
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class AdsManager : MonoBehaviour, IUnityAdsListener
{
private bool testMode = false;
public GameObject gameOverUi;
public GameObject rewardVideoUi;
public GameObject tryAgain;
// Start is called before the first frame update
void Start()
{
Advertisement.AddListener(this);
Advertisement.Initialize("XXXXXXX", testMode);
}
public void ShowAd()
{
if (Advertisement.IsReady("rewardedVideo"))
{
Advertisement.Show("rewardedVideo");
gameOverUi.SetActive(true);
Debug.Log("Advertisement ready");
}
else
{
tryAgain.SetActive(true);
}
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
// Define conditional logic for each ad completion status:
if (showResult == ShowResult.Finished)
{
// Reward the user for watching the ad to completion.
gameOverUi.SetActive(false);
rewardVideoUi.SetActive(true);
}
else if (showResult == ShowResult.Skipped)
{
gameOverUi.SetActive(true);
}
else if (showResult == ShowResult.Failed)
{
gameOverUi.SetActive(true);
}
}
public void OnUnityAdsReady(string placementId)
{
if("rewardedVideo" == placementId)
{
Debug.Log("Id match");
}
}
public void OnUnityAdsDidError(string message)
{
}
public void OnUnityAdsDidStart(string placementId)
{
}
}
`
↧