Monetize your mobile games!
Why Monetize with Unity Ads?
Monetization is a crucial step for game developers looking to support and grow their projects. Unity Ads offers a hassle-free way to add various ad formats, such as interstitials, rewarded videos, and banners, enhancing both user experience and revenue potential.
Step 1: Enable Unity Ads in Your Unity Project
- Open Window → General → Services.
- Sign in or create a Unity account.
- Click Create Project ID under your organization and ensure Ads are turned ON.
- If the Advertisement package isn't installed automatically, use Window → Package Manager to install it manually.
- Tip: If your game is for kids under 13, mark it as child-directed when asked.
Step 2: Switch Your Build Target
Unity Ads works only on Android and iOS:
- Go to File → Build Settings.
- Select Android or iOS and click Switch Platform.
- Wait for Unity to process—once done, the platform's logo appears next to your target.
Step 3: Configure Ads in the Unity Dashboard
- Open the Services tab, click Go to Dashboard.
- Select your project, enable Ads, and choose No mediation.
- Add three ad placements:
videofor interstitialsrewardedVideofor rewarded adsbannerfor banner ads
- Copy your Game IDs (Android/iOS) and Placement IDs for later steps.
Step 4: Script Integration—Your AdsManager
Create a C# script called AdsManager.cs and attach it to a GameObject (like Main Camera).
C#using UnityEngine; using UnityEngine.Advertisements; public class AdsManager : MonoBehaviour, IUnityAdsListener { #if UNITY_IOS string gameID = "YOUR_IOS_GAME_ID"; #else string gameID = "YOUR_ANDROID_GAME_ID"; #endif void Start() { Advertisement.Initialize(gameID); Advertisement.AddListener(this); } // Interstitial public void PlayAd() { if (Advertisement.IsReady("video")) Advertisement.Show("video"); } // Rewarded public void PlayRewardedAd() { if (Advertisement.IsReady("rewardedVideo")) Advertisement.Show("rewardedVideo"); else Debug.Log("Rewarded ad not ready!"); } public void OnUnityAdsDidFinish(string placementId, ShowResult result) { if (placementId == "rewardedVideo" && result == ShowResult.Finished) Debug.Log("Player rewarded!"); } // Banner public void ShowBanner() { if (Advertisement.IsReady("banner")) { Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER); Advertisement.Banner.Show("banner"); } else StartCoroutine(RepeatShowBanner()); } IEnumerator RepeatShowBanner() { yield return new WaitForSeconds(1); ShowBanner(); } public void HideBanner() => Advertisement.Banner.Hide(); }
Step 5: Connect Ad Logic to Your Game
Open your main game script (e.g., GameManager.cs) and link the AdsManager:
C#public AdsManager ads; void Start() { ads.ShowBanner(); } void GameOver() { ads.PlayAd(); } void DoubleScore() { ads.PlayRewardedAd(); }
Then drag the AdsManager GameObject into the public field in the Unity Inspector.
Step 6: Test and Launch!
- Use Play Mode and trigger ads via gameplay or test buttons.
- Interstitials show up between levels.
- Rewarded ads play for double rewards or bonuses.
- Banners stay visible and can be hidden anytime.
- Always test on a real device for live ads—Unity Editor uses test mode!
Congratulations—you’ve just turned your mobile game into a money-making machine with Unity Ads!
