Type Library Revision Release 2024.3703 Keywords ads, advertising, Unity Ads Platforms Android, iOS
The Unity Ads plugin allows developers to monetize users through Unity Ads video interstitial and rewarded video ads.
This documentation is for the new Unity Ads SDK(v4), click to view the Unity Ads legacy plugin
Notable changes from old plugin include now needing to load placement IDs via unityads.load() and the placementStatus
event.phase removal.
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 privacy consent documentation.
Before you can use this plugin, you must register with Unity Ads.
local unityads = require( "plugin.unityads.v4" )
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" }, }, }
If you are building for Android, you should remove any legacy inclusion of the ["plugin.google.play.services"]
plugin from your build.settings
.
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