/// <summary> /// Initializing AppLovin /// </summary> /// <param name="consent">user consent -> if true show personalized ads</param> /// <param name="platformSettings">contains all required settings for this publisher</param> public void InitializeAds(UserConsent consent, UserConsent ccpaConsent, List <PlatformSettings> platformSettings) { debug = Advertisements.Instance.debug; if (initialized == false) { if (debug) { AppLovin.SetVerboseLoggingOn("true"); } //get settings #if UNITY_ANDROID PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.Android); #endif #if UNITY_IOS PlatformSettings settings = platformSettings.First(cond => cond.platform == SupportedPlatforms.iOS); #endif //preparing AppLovin SDK for initialization Debug.Log("APPID: " + settings.appId.id.ToString()); AppLovin.SetSdkKey(settings.appId.id.ToString()); if (consent == UserConsent.Accept || consent == UserConsent.Unset) { AppLovin.SetHasUserConsent("true"); } else { AppLovin.SetHasUserConsent("false"); } if (settings.directedForChildren == true) { AppLovin.SetIsAgeRestrictedUser("true"); } else { AppLovin.SetIsAgeRestrictedUser("false"); } AppLovin.InitializeSdk(); AppLovin.SetUnityAdListener(gameObject.name); if (debug) { Debug.Log(this + " " + "Start Initialization"); ScreenWriter.Write(this + " " + "Start Initialization"); Debug.Log(this + " SDK key: " + settings.appId.id); ScreenWriter.Write(this + " SDK key: " + settings.appId.id); } //start loading ads PreloadInterstitial(); PreloadRewardedVideo(); initialized = true; } }