2

Normally, i have one event system on the scene, but if i display ads (applovin) then one more event system is added. This issue causes "There are 2 event systems in the scene." problem. How can i fix this?

[My scene][1] [1]: https://i.stack.imgur.com/EY5e9.jpg

My applovin ads code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gecis : MonoBehaviour
{
    private const string MaxSdkKey = "--";
    private const string InterstitialAdUnitId = "--";

    // Start is called before the first frame update
    void Start()
    {
        MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {
            // AppLovin SDK is initialized, start loading ads
            InitializeInterstitialAds();
        };
        MaxSdk.SetSdkKey(MaxSdkKey);
        MaxSdk.InitializeSdk();
    }

    private void InitializeInterstitialAds()
    {
        // Attach callbacks
       
       
        MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += InterstitialFailedToDisplayEvent;
        MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialDismissedEvent;


        // Load the first interstitial
        LoadInterstitial();
       
    }

    void LoadInterstitial()
    {
        MaxSdk.LoadInterstitial(InterstitialAdUnitId);
    }

    public void ShowInterstitial()
    {
        if (MaxSdk.IsInterstitialReady(InterstitialAdUnitId))
        {
          
            MaxSdk.ShowInterstitial(InterstitialAdUnitId);
        }
        else
        {
           
        }
    }

    private void InterstitialFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
    {
        // Interstitial ad failed to display. We recommend loading the next ad
        LoadInterstitial();
    }

    private void OnInterstitialDismissedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
    {
        // Interstitial ad is hidden. Pre-load the next ad
        LoadInterstitial();
    }

}
derHugo
  • 83,094
  • 9
  • 75
  • 115
  • Please use the correct tags! Note that [`unityscript`](https://stackoverflow.com/tags/unityscript/info) is or better **was** a JavaScript flavor like custom language used in early Unity versions and is long **deprecated** by now! your code is clearly in `c#` – derHugo Mar 01 '22 at 20:38

1 Answers1

0

Open Assets>MaxSdk>Prefabs and delete EventSystem from each prefab