Initializing the SDK in Unity

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 Ads 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.4.2 is still functional but will not receive any further updates for new or enhanced features. From SDK versions beyond 4.4.2, only native updates will be supported for Android and iOS developers, with no further updates provided for Unity developers.

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.

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()
    public void InitializeAds()
    #if UNITY_IOS
            _gameId = _iOSGameId;
            _gameId = _androidGameId;
    #elif UNITY_EDITOR
            _gameId = _androidGameId; //Only for testing the functionality in the Editor
        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 Implementing basic ads in Unity documentation.