- Home /
Manage Game Music At Fullscreen Ad Display Time
I have used AppLovin Ad Network to display fullscreen ads within the game. So I want to turn off game music when fullscreen ad displayed and again turn on game music when fullscreen ad closed by the game player.
I have followed this guideline:Unity3d Integration
Here we have different listeners available: Ad Listeners in Unity
I was getting the problem in iOS only in Android automatically game background music gets paused and played again when I closed the fullscreen ad.
Code that I have tested up to now:
public void ShowAppLovinInsterstitial()
{
// Showing utilizing PreloadInterstitial and HasPreloadedInterstitial
if (AppLovin.HasPreloadedInterstitial())
{
// An ad is currently available, so show the interstitial.
AppLovin.ShowInterstitial();
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(false);
#endif
}
else
{
// No ad is available. Perform failover logic...
AppLovin.PreloadInterstitial();
}
}
void onAppLovinEventReceived(string ev)
{
if (ev.Contains("HIDDENINTER"))
{
// Ad ad was closed. Resume the game.
// If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
AppLovin.PreloadInterstitial();
}
else if (ev.Contains("CLOSEDFULLSCREEN"))
{
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
}
}
At present, game music gets paused after fullscreen ad displayed. On fullscreen ad, it was not again started. Please give me some suggestion for the gameplay music turn on and off during fullscreen ads display.
Your answer
Follow this Question
Related Questions
AppLovin Ad Network Apple Store Submission SDK Error 1 Answer
AC-130 Game help 1 Answer
How to open a door after a numerical password? 1 Answer
Unity Scaling for Android on 5.5. 0 Answers