unityads.v4.*

Type Library
Revision Release 2026.3728
Keywords ads, advertising, Unity Ads
Platforms Android, iOS

Overview

The Unity Ads plugin allows developers to monetize users through LevelPlay (Unity’s mediation platform, powered by IronSource) video interstitial and rewarded video ads.

Important

This plugin uses the LevelPlay backend (formerly IronSource). Click to view the Unity Ads legacy plugin.

Notable changes from the legacy plugin:

  • Ads must be loaded before showing via unityads.load(), which requires an ad unit ID (configured in the LevelPlay dashboard), not the old placement name.
  • unityads.load() accepts an optional adType parameter ("rewarded" for rewarded video; defaults to interstitial).
  • The placementStatus event.phase has been removed.

Check out setHasUserConsent to enable manual GDPR data collection restrictions.

See more at the LevelPlay privacy consent documentation.

Registration

Before you can use this plugin, you must register and configure your app in the LevelPlay dashboard. Your App Key (used as gameId) and Ad Unit IDs are found there.

Syntax

local unityads = require( "plugin.unityads.v4" )

Functions

unityads.init()

unityads.isLoaded()

unityads.load()

unityads.show()

unityads.setHasUserConsent()

unityads.setPersonalizedAds()

unityads.setPrivacyMode()

Events

adsRequest

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase. 

settings =
{
    iphone =
    {
        plist =
        {
            NSUserTrackingUsageDescription = "Your data will be used to provide you a better and personalized ad experience.",
            SKAdNetworkItems = {
                { SKAdNetworkIdentifier = "4dzt52r2t5.skadnetwork" },
                { SKAdNetworkIdentifier = "bvpn9ufa9b.skadnetwork" },
            },
        },
    },
    android =
    {
        minSdkVersion = "19",
    },
    plugins =
    {
        ["plugin.unityads.v4"] =
        {
            publisherId = "com.solar2d"
        },
    },
}
Important

If you are building for Android, you should remove any legacy inclusion of the ["plugin.google.play.services"] plugin from your build.settings.

Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"
  • "android.permission.ACCESS_NETWORK_STATE"
  • "com.google.android.gms.permission.AD_ID"

Also, minimum Android API level required is 19

Support