Unity Ads

In this article, you will learn how to use Nimbus to request and render Unity Ads.

The Nimbus SDK will automatically import the Unity Ads SDK and handle injecting all the necessary parameters into the outgoing NimbusRequest after initialization. Currently the Nimbus SDK only supports Unity Rewarded Video.

Installation

Include the Nimbus Extension for Unity in your build.gradle(.kts) file. If the Unity Ads SDK is not already included in your application the Nimbus Extension will import it for you.

dependencies {
    implementation("com.adsbynimbus.android:extension-unity:2.+")
}

Configure the SDK to include Unity Demand

Initialize the UnityDemandProvider with your game id provided to you from the Unity Dashboard. Placements for Unity Ads will can be defined using the Nimbus Dashboard.

lateinit var applicationContext: Context
lateinit var gameId: String
UnityDemandProvider.initialize(applicationContext, gameId)

Requesting Unity Ads

Unity Ads are automatically included in the auction if the UnityDemandProvider has been initialized and placement ids for Unity have been setup in Nimbus.

Rewarded video

Unity rewarded video ads are full screen takeovers and must use the following call:

lateinit var requestPositionName: String
val closeButtonDelayInSeconds: Int = 15
val rewardedRequest = NimbusRequest.forRewardedVideoAd(requestPositionName)
nimbusAdManager.showRewardedAd(rewardedRequest, closeButtonDelayInSeconds, activity, listener)

Testing the integration

To test the integration, you can initialize the UnityDemandProvider using the initializeTestMode function instead of initialize which will traffic test ads through Nimbus.

Please ensure the placements have been added in the Nimbus dashboard and are not paused

How it works

The SDK will automatically injects a Unity token into the outbound request to Nimbus when using the NimbusAdManager. When the UnityDemandProvider is initialized it will initialize the Unity SDK which handles requesting tokens for use with Nimbus.

Last updated