Quantcast
Viewing all articles
Browse latest Browse all 1416

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][1]

Here we have different listeners available: [Ad Listeners in Unity][2]

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. [1]: https://dash.applovin.com/docs/integration#iosUnity3dIntegration [2]: https://dash.applovin.com/docs/integration#iosUnityListeners

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>