Unity Plugin Integration

Before You Start

  • We support Unity version 4.6.8 and up.
  • We support Android Operation Systems Version 4.1(API level 16) and up.
  • We support Xcode 9.0 and up as well as CocoaPods.
  • We suggest creating an AdTiming account and registering and Android and iOS app.

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


This Guideline is intended for publishers who need to monetize for an Unity app.

AdTiming offers diversified and competent monetization services and supports a variety of Ad formats including Native Ad, Interstitial Ad, Banner Ad, and Incentive Video Ad. The AdTiming platform mediates AdTiming, AdMob, Facebook, UnityAds, Vungle, Tapjoy, AppLovin, AdColony, Chartboost, Pangle, MoPub and IronSource.


Unity Plugin Demo App

The Unity Plugin Demo Application demonstrate how to integrate the Unity Plugin in your app.

Download Unity Plugin Demo


Step 1. Add the AdTiming Unity Package to Your Project

Disclaimer: Updating the AdTiming SDK

When upgrading from older SDK versions to the AdTiming SDK 6.0.0 and above, you must download and update all mediation adapters.

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

  1. Download AdTiming Unity Plugin
  2. Make sure your Unity project is opened in the Unity editor
  • The AdTiming 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.
  1. Import the Unity package.
  • Navigate to Assets -> Import Package -> Custom Package.


  • Select the AdTimingUnityPlugin(Vx.x.x).unitypackage file..
  • Import all files and make sure to avoid conflicts with files. (Double-click on the extracted file; the different files will be populated automatically as shown below).



Step 2. Unity Integration Manager

Please Note! If your Android application is connected to the SDK of Appsflyer and Vungle at the same time, it will prompt conflict when compiling.Please refer to:Deal with the conflict between AppsFlyer and Vungle.

The AdTiming Integration Manager tool is based on Google External Dependency Manager for Unity (formerly Play Services Resolver). It will enable you to download the latest versions of AdTiming SDK and adapters directly from your Unity development platform.



  • Unity Developer Version 2017.2 or above
  • For iOS – CocoaPods applied

Manage SDK versions

Once you’ve updated your Unity package for the new SDK and Integration Manager, you’ll be able to view the AdTiming sub-menu in the Unity menu bar.


To upgrade your SDK or Adapter versions:

  • Go to AdTiming > Integration Manager
  • Choose “Install” or “Update”

If you already have the latest version of AdTiming SDK or Adapters, the action button will be changed to “Updated”, and will be disabled.


To apply your changes, make sure you use the “Resolve” process. This will download all relevant artifacts, according to your choices.

Manual Resolve
Go to: Assets → External Dependency Manager → Android  Resolver → Resolve

This action should be performed after each change in the AdTiming Integration Manager.

If you’re using Automatic Resolve, all updates will be performed when closing the Integration Manager window.

For Gradle Users

Using AdTiming Integration Manager for Unity, you will be able to avoid downloading the Android artifacts into your project. Instead, the artifacts will be added to your gradle file during the compilation.

To enable this process, follow these steps:

  1. Go to: Assets →External Dependency Manager → Android  Resolver → Settings 
  2. Select “Patch mainTemplate.gradle”
  3. Save your changes, by pressing “OK”



Make sure that CocoaPods is installed:

Go to: Assets → External Dependency Manager → iOS Resolver → Install CocoaPods


Step 3. Additional Settings for iOS

App Transport Security Settings

  • Add in a Dictionary called 'App Transport Security Settings'. Make sure you add this dictionary on the 'Top Level Key'.

  • Inside this dictionary, add a Boolean called 'Allow Arbitrary Loads' and send it to YESUnityiOSSetting.png

Info.plist Settings (optional)

If you added the AdMob SDK using the Unity integration manager tool, you need to add a GADApplicationIdentifier whose string value is your AdMob application ID in the drop-down box of the Admob column. You can find your app ID in the AdMob interface.


Please Note: Be sure to use your actual AdMob app ID instead of the ID listed above .

Importrant! This step is required since the Google Mobile Ads SDK version 7.42.0. Failure to add this Info.plist entry will result in a crash with the following message: "The Google Mobile Ads SDK was initialized incorrectly."



Step 4. Initialize the Ad Units

Before loading ads, initialize the AdTiming SDK by calling AdTiming.Agent.init(“appKey”) with your AppKey. This is best done at the time of the app launch, and only needs to be done once. Here’s an example of how to call Init() within the Start() method of a script attached to a GameObject. 

public void Start() {
    AdTiming.Agent.init("Your AdTimingAppKey");

Implement the Init Events

The AdTiming Unity Plugin fires init events to inform you of SDK initialization results.

Add the following code to register to the events:

void OnEnable () {
AdTimingEvents.onSdkInitSuccessEvent += SdkInitSuccessEvent;
AdTimingEvents.onSdkInitFailedEvent += SdkInitFailedEvent;

The Plugin will notify the Listener of all possible events listed below: 

void SdkInitSuccessEvent(){

void SdkInitFailedEvent(){


After calling the init() method, you can also use the following code to determine whether the SDK has been successfully initialized.

// To determine the result of init()


Set IAP Parameter(optional)

IAP, an acronym for in-App Purchase, can be understood as an in-app purchase. We need you to pass the current device user's IAP data to the SDK through the setIap method in the APP so that we can provide more accurate advertising.

AdTiming.Agent.setIap(float count, String currency); 

The parameter currency is a String represents the currency code of the ISO, based on the International Organization for Standardization's national code, is published in the ISO 4217:2008 standard and is used to represent money and funds.

You could set IAP after SDK initial successfully, such as at the time the IAP data is changed.

AdTiming.Agent.setIap(12.30, 'USD');


Send attribution data to AdTiming(optional)

If your project also integrates the AppsFlyer SDK, we need you to pass the application attribution data to AdTiming so that we can help you accurately calculate each Media Source, Campaign level ROAS, and LTV data.

1. When you receive the onConversionDataSuccess callback you can use the sendAFConversionData method for passing the attribution data dictionary:

public void onConversionDataSuccess(string conversionData) {

2. When you receive the onAppOpenAttribution callback you can use the sendAFDeepLinkData method for passing the attribution data dictionary:

public void onAppOpenAttribution(string validateResult) {


Step 5. Setting for iOS 14


  • Add in a Array called 'SKAdNetworkItems'. Make sure you add this dictionary on the 'Top Level Key'.

  • Add a Dictionary to the Array , add a String called 'SKAdNetworkIdentifier' and set value to '488r3q3dtq.skadnetwork'.


App Tracking Transparency

  • To display the App Tracking Transparency authorization request for accessing the IDFA, update your Info.plist to add the NSUserTrackingUsageDescription key with a custom message describing your usage.


  • To present the authorization request, call requestTrackingAuthorizationWithCompletionHandler:. We recommend waiting for the completion callback prior to loading ads, so that if the user grants the App Tracking Transparency permission, the AdTiming SDK can use the IDFA in ad requests.
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestUserIDFA { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { // Tracking authorization completed. Start loading ads here.
// [self loadAd];
import AppTrackingTransparency
import AdSupport
func resquestUserIDFA() { ATTrackingManager.requestTrackingAuthorization(completionHandler: {status in // Tracking authorization completed. Start loading ads here.
// loadAd()


What’s Next?

Refer to the Ad Unit to integrate Rewarded Video, Interstitial and Banner Ads in your app.


Was this article helpful?
4 out of 4 found this helpful



Article is closed for comments.