ad audio callback help pleeeeeeease!!!
Hi I am using the monetization API and everything is working fine but once a button is clicked and a reward video ad is played then the audio is muted (which is fine) but once it is finished it can't be clicked again and the audio does not play at all :(.
Here is the code...
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Monetization;
public class Ads : MonoBehaviour {
public static Ads instance;
private string playStoreID = "---------";
private string vidad = "xxxxxxx";
private string rewardedVideoAD = "yyyyyyy";
private string BannerAD = "zzzzzzzz";
public AudioSource audioToMute;
private void Awake()
{
if (instance != null)
{
Destroy(gameObject);
}
else
{
instance = this;
DontDestroyOnLoad(gameObject);
}
}
void Start()
{
Monetization.Initialize(playStoreID, true);
}
void ToggleMute(ShowResult result = default(ShowResult))
{
audioToMute.mute = !audioToMute.mute;
}
public void ShowRewardVideoAD2()
{
if (Monetization.IsReady(zzzzzzz))
{
ShowAdPlacementContent ad = null;
ad = Monetization.GetPlacementContent(zzzzzzz) as ShowAdPlacementContent;
if (ad != null)
{
// Mute our audio while the ad is shown.
ToggleMute();
// Prep a callback to fire when the ad completes, fails, or get skipped:
// ShowOptions has an error with it
var adOptions = new **ShowOptions** { resultCallback = ToggleMute };
//Show our ad with this callback option set.
ad.Show();
}
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612225130im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity Ads rewarded video no result, Android 1 Answer
Unity Ads Callback Problem,Unity ads callback problem 5 Answers
ISerializationCallbackReceiver - total confusion or simply unstable? 0 Answers
Can i use some filter in Unity Ads for "Designed for Families"? 0 Answers
Add Reference UnityEngine.Advertisements to Visual Studio 2017 1 Answer