/// <summary> /// Use to create multiple Ads. /// </summary> /// <param name="descs">Your AdDesc settings.</param> /// <param name="createdCallback">The callback that fires when done.</param> /// <returns>Returns array of Ad objects</returns> public static InterstitialAd[] CreateAd(InterstitialAdDesc[] descs, InterstitialAdCreatedCallbackMethod createdCallback) { if (creatingAds) { Debug.LogError("You must wait for the last interstitial ads to finish being created!"); if (createdCallback != null) { createdCallback(false); } return(null); } creatingAds = true; InterstitialAdManager.createdCallback = createdCallback; int startLength = plugins.Count; for (int i = 0; i != descs.Length; ++i) { plugins.Add(InterstitialAdPluginAPI.New(descs[i], async_CreatedCallback)); } var ads = new InterstitialAd[descs.Length]; for (int i = 0, i2 = startLength; i != descs.Length; ++i, ++i2) { ads[i] = new InterstitialAd(plugins[i2]); } return(ads); }
/// <summary> /// Use to create a single Ad. /// </summary> /// <param name="desc">Your AdDesc settings.</param> /// <param name="createdCallback">The callback that fires when done.</param> /// <returns>Returns Ad object</returns> public static InterstitialAd CreateAd(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback) { if (creatingAds) { Debug.LogError("You must wait for the last interstitial ad to finish being created!"); if (createdCallback != null) { createdCallback(false); } return(null); } creatingAds = true; InterstitialAdManager.createdCallback = createdCallback; plugins.Add(InterstitialAdPluginAPI.New(desc, async_CreatedCallback)); return(new InterstitialAd(plugins[plugins.Count - 1])); }