Enabling 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 game platform that supports the Yandex Mobile Ads SDK.

Note.
  1. To load ads of any type, you need iOS 12.0 or later.
  2. To run the SDK, you need the Target API Level 31 or higher.
  1. Integrating the plugin
  2. Downgrading the Target API Level

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.

    How to add a package
    Select a plugin (Assets → Import Package → Custom Package), then click Import.
  2. Add the Google resolver: download the directory unity-jar-resolver and add the package external-dependency-manager-latest.unitypackage.

    How to add a package
    Select a plugin (Assets → Import Package → Custom Package), then click Import.
  3. Use the Google resolver to install dependencies: enable auto-resolve or select Assets → External Dependency Manager → Android Resolver → Resolve in the menu.
  4. 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 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 an outdated version of the Target API Level. Learn more in the article.