/// <summary> /// Allows you to hide a banner ad, instead of destroying it altogether. /// </summary> public void Hide(bool destroy = false) { m_showing = false; if (destroy) { loaded = false; return; } m_ShowOptions?.hideCallback(); }
public void UnityAdsBannerDidHide(string placementId, BannerOptions bannerOptions) { var hideCallback = bannerOptions?.hideCallback; if (hideCallback != null) { UnityLifecycleManager?.Post(() => { bannerOptions.hideCallback(); }); } }
/// <summary> /// Displays the banner ad with a specified <a href="../manual/MonetizationPlacements.html">Placement</a>, but fires the <c>showCallback</c> callback if the banner is visible, and the <c>hideCallback</c> if it isn't. /// </summary> /// <param name="placementId">The unique identifier for a specific Placement, found on the <a href="https://operate.dashboard.unity3d.com/">developer dashboard</a>.</param> /// <param name="options">A collection of options that notify the SDK of events when displaying the banner.</param> public static void Show(string placementId, BannerOptions options) { if (s_UnloadHandler == null) { s_UnloadHandler = (object sender, EventArgs args) => { if (s_StartHandler != null) { s_Platform.Banner.OnShow -= s_StartHandler; s_StartHandler = null; } if (s_HideHandler != null) { s_Platform.Banner.OnHide -= s_HideHandler; s_HideHandler = null; } s_Platform.Banner.OnUnload -= s_UnloadHandler; }; s_Platform.Banner.OnUnload += s_UnloadHandler; } if (options != null) { if (options.showCallback != null && s_StartHandler == null) { s_StartHandler = (object sender, StartEventArgs args) => { options.showCallback(); }; s_Platform.Banner.OnShow += s_StartHandler; } if (options.hideCallback != null && s_HideHandler == null) { s_HideHandler = (object sender, HideEventArgs args) => { options.hideCallback(); }; s_Platform.Banner.OnHide += s_HideHandler; } } s_Platform.Banner.Show(string.IsNullOrEmpty(placementId) ? null : placementId); }