Hey guys I am really hoping for some help on this one. In my game I have a button that once pressed mutes all sound and music. I have monetized my game with Google Admob and I am using the official Admob Unity Plugin. My problem is that when an interstitial is shown it is not muted. I want to mute my ads when my game is muted. Can anyone help me accomplish this?
My script for displaying ads looks like this:
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class AdmobScript : MonoBehaviour {
private static string interstitialId;
private static InterstitialAd interstitial;
private static AdRequest interstitialRequest;
public static int counter;
void Awake()
{
DontDestroyOnLoad(gameObject);
}
void Start ()
{
#if UNITY_ANDROID
interstitialId = "ca-app-pub-1518441074738585/3382052954";
#elif UNITY_IPHONE
interstitialId = "ca-app-pub-1518441074738585/2544448158";
#else
interstitialId = "unexpected platform";
#endif
counter = 0;
requestInterstitial ();
}
public static void requestInterstitial()
{
interstitial = new InterstitialAd (interstitialId);
interstitialRequest = new AdRequest.Builder ().TagForChildDirectedTreatment(true).Build ();
interstitial.LoadAd (interstitialRequest);
}
public static void showInterstitial()
{
if (interstitial.IsLoaded())
{
interstitial.Show ();
}
}
public static bool isAdReady()
{
return interstitial.IsLoaded ();
}
}