0
\$\begingroup\$

Hi I have a callback in my ads manager that says that when the scene loads, then automatically play the ad, mute the background audio and then once ad has finished or skipped then play background music and done.

Problem is that this works once and then when the scene loads again then the ads do not play.

Below is the code please help!!!

public static Ads instance;
private string playStoreID = "XXXXXXXX";

private string vidad = "XXXXXX";
private string rewardedVideoAD = "YYYYYYY";
private string BannerAD = "ZZZZZZ";



private void Awake()
 {
if (instance != null)
{

    Destroy(gameObject);
}

else
{
    instance = this;
    DontDestroyOnLoad(gameObject);
}
}

void Start()
{
Monetization.Initialize(playStoreID, true);
}



public void ShowInterstitialAD()
{

  if (Monetization.IsReady(vidad))
  {
    ShowAdPlacementContent ad = null;
    ad = Monetization.GetPlacementContent(vidad) as ShowAdPlacementContent;


    if (ad != null)
    {
        ToggleMute();


        ad.Show(ToggleMute);
    }
}

 }

 void ToggleMute(ShowResult finishState = default(ShowResult))
 {
 audioToMute.mute = !audioToMute.mute;
 }

 public void ShowRewardVideoAD2()
 {

if (Monetization.IsReady(rewardedVideoAD))
{
    ShowAdPlacementContent ad = null;
    ad = Monetization.GetPlacementContent(rewardedVideoAD) as ShowAdPlacementContent;


    if (ad != null)
    {
        ToggleMute();


        ad.Show(ToggleMute);
    }
}

}


  public void ShowRewardVideoAD()
  {

  if (Monetization.IsReady(rewardedVideoAD))
  {
    ShowAdPlacementContent ad = null;
    ad = Monetization.GetPlacementContent(rewardedVideoAD) as ShowAdPlacementContent;


    if (ad != null)
    {

        ToggleMute();


        ad.Show(ToggleMute);
    }
}

 }

 }
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.