Unity : Ajouter des rewarded ads + interstitials (monétisation facile)

Dans le monde du développement mobile, la monétisation par pubs reste le Saint-Graal pour les jeux hyper-casual, casual ou même hybrid-casual. Avec Unity Ads (le service officiel d’Unity), tu peux intégrer des rewarded ads (pubs vidéo récompensées, ex. : revive/extra vies) et des interstitials (pubs plein écran entre niveaux) en moins d’1 heure. Résultat ? Un ARPU boosté de 0,50-2€/user sans IAP complexes.

Ce tuto Unity 6 / 2022.3+ (testé mars 2026) te guide pas-à-pas avec code C# prêt-à-copier, best practices et tests. Idéal pour ton premier jeu Android/iOS monétisé. Pas besoin d’AdMob ou IronSource – Unity Ads est gratuit, simple et performant (eCPM moyen 5-15$).

Prérequis

  • Compte Unity Ads : Crée un compte gratuit → Crée un projet → Note ton Game ID (Android/iOS séparés) et Placement IDs (rewarded_video, interstitial par défaut).
  • Unity 2022.3 LTS ou Unity 6.
  • Projet mobile (Android/iOS build settings).
  • Test Mode activé (pour éviter bans Play Store).

Étape 1 : Installer le package Unity Ads via Package Manager

  1. Ouvre Unity → Window > Package Manager.
  2. Sélectionne Unity Registry (gauche).
  3. Cherche Advertisement Legacy (version 4.12+ en 2026) → Install.
    • Ça ajoute using UnityEngine.Advertisements;.

Astuce : Si migration LevelPlay/IronSource, installe aussi Ads Mediation pour hybride, mais on reste simple ici.

Étape 2 : Initialiser le SDK

Crée un script AdManager.cs (singleton, attache à un GameObject vide « AdManager » en scène persistante via DontDestroyOnLoad).

using UnityEngine;
using UnityEngine.Advertisements;

public class AdManager : MonoBehaviour, IUnityAdsInitializationListener, IUnityAdsLoadListener, IUnityAdsShowListener
{
    public string androidGameId = "TON_ANDROID_GAME_ID";  // Ex: 1234567
    public string iOSGameId = "TON_IOS_GAME_ID";
    public string rewardedPlacementId = "rewarded_video";  // De ton dashboard
    public string interstitialPlacementId = "interstitial";

    [HideInInspector] public bool isInitialized = false;
    private string gameId;

    void Awake()
    {
        DontDestroyOnLoad(gameObject);
    }

    void Start()
    {
        gameId = (Application.platform == RuntimePlatform.IPhonePlayer) ? iOSGameId : androidGameId;
        Advertisement.Initialize(gameId, true);  // true = test mode
    }

    public void OnInitializationComplete()
    {
        isInitialized = true;
        Debug.Log("Unity Ads initialized !");
        LoadRewardedAd();  // Précharge direct
        LoadInterstitialAd();
    }

    public void OnInitializationFailed(UnityAdsInitializationError error, string message)
    {
        Debug.LogError($"Init failed: {error} - {message}");
    }
}
  • Explication : Initialize connecte au dashboard. Test mode = pubs fake (pas de ban). Callbacks gèrent succès/erreurs.

Étape 3 : Implémenter Rewarded Ads (pubs récompensées)

Ajoute ces méthodes à AdManager.cs :

public void ShowRewardedAd(System.Action onReward, System.Action onClose)
{
    if (isInitialized && Advertisement.IsReady(rewardedPlacementId))
    {
        Advertisement.Show(rewardedPlacementId, this, onReward);
    }
    else
    {
        LoadRewardedAd();  // Retry load
    }
}

public void OnUnityAdsAdLoaded(string placementId) { /* Auto-reload après show */ }
public void OnUnityAdsFailedToLoad(string placementId, UnityAdsLoadError error, string message) { Debug.LogError($"Load failed {placementId}: {error}"); }
public void OnUnityAdsShowFailure(string placementId, UnityAdsShowError error, string message) { Debug.LogError($"Show failed {placementId}: {error}"); }
public void OnUnityAdsShowStart(string placementId) { Time.timeScale = 0; /* Pause game */ }
public void OnUnityAdsShowClick(string placementId) { /* Analytics */ }
public void OnUnityAdsShowComplete(string placementId, UnityAdsShowCompletionState showCompletionState)
{
    if (placementId == rewardedPlacementId && showCompletionState == UnityAdsShowCompletionState.COMPLETED)
    {
        // Récompense !
        Debug.Log("Reward granted ! +1 vie");
        // Ex: PlayerPrefs.SetInt("lives", PlayerPrefs.GetInt("lives") + 1);
    }
    Time.timeScale = 1;  // Resume
}

void LoadRewardedAd() { Advertisement.Load(rewardedPlacementId, this); }
  • Utilisation : Dans ton GameManager, sur bouton « Revive » : adManager.ShowRewardedAd(GiveExtraLife, OnAdClosed);

Étape 4 : Implémenter Interstitials (pubs plein écran)

Même script, ajoute :

public void ShowInterstitialAd()
{
    if (isInitialized && Advertisement.IsReady(interstitialPlacementId))
    {
        Advertisement.Show(interstitialPlacementId, this);
    }
    else
    {
        LoadInterstitialAd();
    }
}

void LoadInterstitialAd() { Advertisement.Load(interstitialPlacementId, this); }

// Les callbacks OnUnityAdsShow* gèrent déjà (pause/resume)
  • Idéal pour : Game Over, fin niveau, pause menu.

Étape 5 : UI & Intégration jeu

  1. Crée Canvas UI → Buttons « Regarder pub pour +1 vie » et « Pub suivante ».
  2. Attache scripts : GetComponent<AdManager>().ShowRewardedAd(…);
  3. Pause game : Time.timeScale = 0; avant show, =1 après.

Étape 6 : Tests & Build

  • Test Mode : Pubs courtes/fake. Vérifie logs Unity Console.
  • Dashboard Unity : Crée « Test Devices » (ton device ID via logs).
  • Build APK/iOS → Soumets Play Store (pubs OK si non-intrusives).
  • Analytics : Unity Dashboard tracke impressions, eCPM, ARPU live.

Best Practices Monétisation 2026

  • Fréquence : Rewarded = 3-5/jour max/user. Interstitial = 1-2/session (game over uniquement).
  • Précharge : Toujours Load() après Show().
  • GDPR : Ajoute Advertisement.SetUserId(« anon »); + consent popup.
  • Hybrid : Combine avec IAP/remove ads (20% revenus IAP).
  • eCPM boost : Placement A/B testing via dashboard. Vise 80% fill rate.
  • Évite bans : Pas d’ads forcées, test mode OFF en prod.
Type PubPlacement IdéaleCPM Moyen 2026Vues/Jour/User
RewardedRevive, extra moves10-20$2-4
InterstitialGame Over, level end5-12$1-3

Potentiel : 10k DAU = 5-20k€/mois (basé sur Unity Analytics 2025-2026).

Conclusion

Avec ce setup, ton jeu est monétisé en 30 min ! Teste sur un prototype hyper-casual (block puzzle comme on en parlait). Prochain tuto : Bannières + Unity Analytics.

Leave a Reply

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Facebook Twitter Instagram Linkedin Youtube