unityads.*

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

Overview

The Unity Ads plugin allows developers to monetize users through Unity Ads video interstitial and rewarded video ads.

Important

This is a legacy Unity Ads plugin using Unity SDK v3, see Unity SDK v4

On a per-app basis, the first time a Unity ad appears, the user will see a banner with the option to opt-out of behaviorally targeted advertising. Thereafter, the user can click an information button to receive the opt-out again.

Although UnityAds will automatically present users with an opportunity to opt-out of targeted advertising, with no implementation needed from the publisher, check out new setHasUserConsent method to enable manual GDPR data collection restrictions.

See more at Unity Ads GDPR Compliance doc page

Registration

Before you can use this plugin, you must register with Unity Ads.

Syntax

local unityads = require( "plugin.unityads" )

Functions

Events

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"] =
        {
            publisherId = "com.coronalabs"
        },
    },
}
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"

Also, minimum Android API level required is 19

Support