Unity Plugin Integration

Before You Start

We support Unity version 5.6 and up.
We support Android Operating Systems Version 4.1 (API level 16) and up.
In case using XCode version lower than 9.3, we suggest archiving with ‘bitcode‘ disabled.

The download, use and access to the SDK is subject to the ironSource Mobile SDK Publisher Online Terms & Conditions. If you do not agree to the terms of ironSource Mobile SDK Publisher Online Terms & Conditions, do not download, access, or use the SDK, or the underlying services.

As of SDK 18.0.0, AdMob migrated from Android Support Libraries to Jetpack (AndroidX) Libraries. Refer to the Google Play services release notes for more information.

Due to this, when working with AdMob adapter it’s required that your project will use Jetpack Libraries (Android X). If you’re using old support library you can use  Migration Tool to migrate your project to use AndoridX. 

In case you can not migrate the project using this tool, you can use the following flags in Android Studio gradle.properties, to build your project using AndroidX. 


Step 1. Add the IronSource Unity Package to Your Project

Follow these steps to add the IronSource Unity Package to your project:

  1. Download Unity Plugin Version
  2. Make sure your Unity project is opened and import the Unity package.
  3. Double-click on the extracted file; the different files will be populated automatically as shown below:

Important! Using the Unity Editor with the ironSource SDK
The ironSource SDK is designed to work with the Android & iOS platform. The Unity Editor contains a Simulator to work with Unity code. In order to work with our plugin, you must target either an Android or iOS build to test the integration.

ironSource Mediation Demo App

The Integration Demo application demonstrate how to integrate the ironSource Mediation in your app

Download Unity Demo Application

Step 2. Android Identifiers 

Make sure you integrate Google Identifier and basement correctly.

Gradle Integration (Recommended)

  1. Go to Build Settings -> Player Settings -> Publishing Settings and check Custom Gradle Template
    screen-shot-2018-10-31-at-15-01-13This will generate template gradle file inside Assets -> Plugins -> Android called mainTemplate.gradle
  2. make sure you have the following lines inside  allprojects->repositories block
    allprojects {
      repositories {
         flatDir {
           dirs 'libs'
  3. Add the Play Services dependencies into the dependencies block

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' 
        implementation 'com.google.android.gms:play-services-basement:17.1.1'
Note: ironSource SDK requires  google play services Basement and google play services Identifier, while other networks may also require additional google play services.

Step 3. Additional Settings for iOS

  1. Add Ad-Support.framework to Your Xcode Project 
    Our Unity Plugin usually adds all the required frameworks automatically. In some cases, the AdSupport.framework can’t be added automatically using Unity 5.6. Verify if the framework has been added and in the case it has not been added automatically, make sure to add it manually.
  2. iOS9 App Transport Security Settings
     In iOS9, Apple has added in controls around ‘ATS’. In order to ensure uninterrupted support for ironSource Ad delivery across all Mediation Networks, it’s important to make the following changes in your info.plist:

    • Add in a dictionary called ‘NSAppTransportSecurity‘. Make sure you add this dictionary on the ‘Top Level Key‘.
    • Inside this dictionary, add a Boolean called ‘NSAllowsArbitraryLoads‘ and set it to YES.
      Supersonic iOS9 App Transport Security Settings
       Note: Make sure that your info.plist does not contain any other exceptions besides ‘NSAllowsArbitraryLoads‘, as this might create a conflict.

Step 4. Initialize the Ad Units

ironSource supports optional SDK settings such as UserID and Segments that must be configured before you initialize the SDK. See our guide on Additional SDK Settings for setup instructions.
Note: If you’re serving the Offerwall ad unit or using server-to-server callbacks to reward your users with our rewarded ad units, you must set the UserID.

Application State

First, you’ll need to pass the state of the application by executing the following event function during the Application Lifecycle.

Call onApplicationPause in each of the Unity Scenes:

void OnApplicationPause(bool isPaused) {                 

Init the Plugin & Ad Units

You can initialize the plugin in two ways. We recommend the first method as it will fetch the specific ad units you define.

  1. This method will init the specific ad units mentioned in the adUnits parameter:
    IronSource.Agent.init (YOUR_APP_KEY, IronSourceAdUnits.REWARDED_VIDEO, IronSourceAdUnits.INTERSTITIAL, IronSourceAdUnits.OFFERWALL, IronSourceAdUnits.BANNER);

    New! When using this init approach, you can now initialize each ad unit separately at different touchpoints in your app flow in one session.

    //For Rewarded Video
    IronSource.Agent.init (YOUR_APP_KEY, IronSourceAdUnits.REWARDED_VIDEO);
    //For Interstitial
    IronSource.Agent.init (YOUR_APP_KEY, IronSourceAdUnits.INTERSTITIAL);
    //For Offerwall
    IronSource.Agent.init (YOUR_APP_KEY, IronSourceAdUnits.OFFERWALL);
    //For Banners
    IronSource.Agent.init (YOUR_APP_KEY, IronSourceAdUnits.BANNER);
  2. Alternatively, you can init the SDK as detailed below and the SDK will init the ad units you’ve configured on the ironSource platform:
    IronSource.Agent.init (YOUR_APP_KEY);

Step 5. Verify Your Integration

The ironSource SDK provides an easy way to verify that your Rewarded Video Mediation integration was completed successfully. To verify your ironSource SDK integration as well as any additional Ad Networks you have implemented, simply add this method to your project:


For more details on the ironSource Integration Verification tool navigate to this article.

For Proguard Users Only

If you are using ProGuard with the ironSource SDK, you must add the following code to your ProGuard file (Android Studio: proguard-rules.pro or Eclipse: proguard-project.txt):

-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
    public *;
-keepclassmembers class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
-keep public class com.google.android.gms.ads.** {
   public *;
-keep class com.ironsource.adapters.** { *;
-keep class com.ironsource.unity.androidbridge.** { *;

-dontwarn com.ironsource.mediationsdk.**
-dontwarn com.ironsource.adapters.**
-dontwarn com.moat.**
-keep class com.moat.** { public protected private *; }

You are now ready to start working with ironSource’s Ad Units and Mediation Tools.

What’s Next?

Once you’ve verified your integration with the Integration Helper, follow our integration guides and implement our Ad Units:

Interested in Mediation? Integrate our Rewarded Video or Interstitial Ads in your app and follow our Mediation articles.

You can read this article in: