Adding the Mobile Ads Unity plugin

Warning.

This is an archived version of the documentation. Actual documentation for all platforms can be found here.

Mobile Ads Unity is a plugin for the Unity3d gaming platform that includes support for the Yandex Mobile Ads SDK.

Note.
  1. To run the SDK, you need the Target API Level version 31 or higher.
  2. To upload ads of any type, you need iOS 12.0 or higher.
  1. Integrating the plugin
  2. Downgrading the Target API Level
  3. Error description

Integrating the plugin

Note. yandex-ads-unity-plugin runs only in Android and iOS environments. You can't use it in the Unity editor.
Lite version
  1. Download the directory yandex-ads-unity-plugin and add the package yandex-mobileads-lite-2.9.0.unitypackage. You will be prompted to install the Google resolver with the package. If you already added the Google resolver to your project, clear the checkbox.

    How to add the package
    Select your plugin (Assets → Import Package → Custom Package), then click Import.
  2. Use the Google resolver to install dependencies: enable auto-resolve or select Assets → External Dependency Manager → Android Resolver → Resolve in the menu.
  3. To test the Mobile Ads Unity plugin, use a sample script from the samples directory in the yandex-ads-unity-plugin repository. Copy the script to the project directory and add it as a Component to the main camera.

Downgrading the Target API Level

To downgrade the Target API Level to version 30, add the explicit downgrade to mainTemplate.gradle and launcherTemplate.gradle (if you use launcherTemplate in the project):

configurations.all {
    resolutionStrategy {
        force 'androidx.core:core:1.6.0'
        force 'androidx.core:core-ktx:1.6.0'
    }
}

However, we recommend that you upgrade to the Target API Level 31, because Google has restrictions on releasing updates for applications running outdated versions of the Target API Level. Learn more in the article.

Error description

Interstitial Unity Ads aren't displayed, error “Incorrect fullscreen view”

The error “Incorrect fullscreen view” may arise when launching interstitial ads on iOS. If this issue arises, make sure that you added the value YandexMobileAdsBundle.bundle under Copy Bundle Resources in the Build Phases settings. If the value is missing, add it.