Documentation

Development

User Acquisition

Monetization

Industry

Unity Ads Monetization

Unity Ads Android SDK

Unity Ads iOS SDK

Unity Ads SDK

Unity Ads Monetization

Unity Ads Monetization
​
​
Unity developer guide
  • Unity SDK overview
  • Install the Unity Ads SDK for Unity
  • Initialize the SDK in Unity
  • Implement interstitial ads in Unity
  • Implement rewarded ads in Unity
  • Implement banner ads in Unity
Unity Ads API reference
  • Unity Ads for Unity API reference (C#)
  1. Grow your game
  2. Unity Ads
  3. Unity Ads SDK integration guide for Unity developers

Initialize the SDK in Unity

Initialize the Unity Ads SDK with your Game ID to enable monetization and access Unity Ads public APIs in your Unity project.
Read time 1 minute
Last updated 4 months ago

To initialize the SDK, you must reference your project's Game ID for the appropriate platform. You can locate the Game ID from the Unity Monetization Dashboard by selecting the Monetization suite, navigating to your current project, then Settings in the secondary navigation bar, and scrolling to the Game IDs section.
Note
Starting from SDK version 4.4.1, the Unity Ads package is now called the Advertisement Legacy package in the Unity Editor. The Advertisement Legacy package version 4.12 is still functional but will not receive any further updates for new or enhanced features. SDK version 4.12 supports the Apple Privacy Manifest update, with no further updates planned for the package.
In your game script header, include the
UnityEngine.Advertisements
namespace. Initialize the SDK early in the game's run-time life cycle, preferably at launch, using the
Initialize
function. In SDK versions 3.7.0 and later, you can use
IUnityAdsInitializationListener
callbacks to receive a notification when initialization is complete, or receive the details when an error occurs.

SDK initialization example

using UnityEngine;using UnityEngine.Advertisements;public class AdsInitializer : MonoBehaviour, IUnityAdsInitializationListener{ [SerializeField] string _androidGameId; [SerializeField] string _iOSGameId; [SerializeField] bool _testMode = true; private string _gameId; void Awake() { InitializeAds(); } public void InitializeAds() { #if UNITY_IOS _gameId = _iOSGameId; #elif UNITY_ANDROID _gameId = _androidGameId; #elif UNITY_EDITOR _gameId = _androidGameId; //Only for testing the functionality in the Editor #endif if (!Advertisement.isInitialized && Advertisement.isSupported) { Advertisement.Initialize(_gameId, _testMode, this); } } public void OnInitializationComplete() { Debug.Log("Unity Ads initialization complete."); } public void OnInitializationFailed(UnityAdsInitializationError error, string message) { Debug.Log($"Unity Ads Initialization Failed: {error.ToString()} - {message}"); }}
Next steps: To continue your integration, refer to the Implement interstitial ads in Unity documentation.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • SDK initialization example


Report a problem with this page
​
​