🥞Batch Serve Ad

Quickly serve or disable ads across all scenes using ReneVerse’s Batch Serve Ad system.

🥞 About Batch Serve Ad

The Batch Serve Ad functionality makes it easy to populate multiple ad surfaces across scenes in one go—perfect for efficient ad management at scale.

🌍 Global Registration

All ad surfaces are automatically registered globally once instantiated—no manual work required. Just place them in your scene, and the SDK takes care of the rest.

📦 How It Works

  1. Batch Request: A single request is sent to the server, asking for ad content for all registered surfaces.

  2. Even Distribution: Ads are returned and evenly assigned to all eligible ad surfaces.

  3. Gizmos in Editor: When selecting an ad surface in the editor, gizmos appear to help visualize ad placement and orientation.


🧪 Preview in Unity Editor

You can trigger batch serving directly from the editor via: Window → ReneVerse → BatchServeAd

BatchServeAd is only available in Play Mode.

🧑‍💻 Runtime Integration

Example 1 – Simple Scene Use:

using ReneVerse;
using UnityEngine;

public class InSceneScript : MonoBehaviour
{
    private void Awake()
    {
        ReneAPIManager.BatchServeAd();
    }
}

Example 2 – During Transition from Another Scene:

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; using UnityEngine.SceneManagement; 
using ReneVerse;

public class LoadingManagerExample : MonoBehaviour {
public string nextSceneWithAdSurfaces; 
public GameObject loadingScreen;

private void Start()
{
    StartCoroutine(LoadSceneAndBatchServeAdCoroutine());
}

private IEnumerator LoadSceneAndBatchServeAdCoroutine()
{
    // Display the loading screen
    loadingScreen.SetActive(true);

    // Load the next scene asynchronously
    AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(nextSceneWithAdSurfaces);

    // Wait until the asynchronous scene fully loads
    while (!asyncLoad.isDone)
    {
        yield return null;
    }

    // Ensure all ad surfaces are registered

    // Call the batch serve ad function asynchronously
    yield return BatchServeAdWrapper();

    // Hide the loading screen
    loadingScreen.SetActive(false);
}

private IEnumerator BatchServeAdWrapper()
{
    var task = ReneAPIManager.BatchServeAd();
    while (!task.IsCompleted)
    {
        yield return null;
    }

    if (task.Exception != null)
    {
        Debug.LogError($"BatchServeAd failed: {task.Exception}");
    }
}
}

❌ Batch Disable Ads

Need to clear ads all at once—for example, during testing? You can disable all currently served ads using:

ReneAPIManager.BatchDisableAds();

Or directly from the editor: Window → ReneVerse → BatchDisableAds

Last updated