Question by
surajkm07 · Nov 17, 2020 at 08:18 AM ·
unity adsadvertising
Unity Ads show failed: Unity Ads is not initialized
The New Unity Advertisement package downloaded from Package manage is giving out "Unity Ads show failed: Unity Ads is not initialized" error in Android Build. it is showing the test ad page in the editor. I got this error in the adb log. Here's what I have done to implement it,
Installed Advertisement package from package manager
Turned Ads and testing on in Services and Dashboard
Followed the "Rewarded video using button" code in the Advertisement doc from unity
Here's my code,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class AdvertisementManager : MonoBehaviour, IUnityAdsListener
{
#if UNITY_IOS
private string gameId = "3912236";
#elif UNITY_ANDROID
private string gameId = "3912237";
#endif
private string myPlacementId = "reviveAdv";
private void Start()
{
Advertisement.Initialize(gameId, true);
Debug.Log("Game ID " + gameId);
Debug.Log("Placement ID " + myPlacementId);
Advertisement.AddListener(this);
}
//This method is linked to the button
public void ShowReviveAd()
{
Advertisement.Show(myPlacementId);
}
public void OnUnityAdsReady(string placementId)
{
if(placementId == myPlacementId)
Debug.Log("Ad Ready " + placementId);
}
public void OnUnityAdsDidError(string message)
{
Debug.Log("Error " + message);
}
public void OnUnityAdsDidStart(string placementId)
{
if (placementId == myPlacementId)
Debug.Log("Did Start " + placementId);
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
if(showResult == ShowResult.Finished)
{
PlayerController.Instance.RewardedLife();
}
}
}
I have checked connectsettings, cross verified the data with the dashboard etc, nothing seems to help.
Comment