Network Mediation Settings

Mediation settings enable you to pass in third-party network-specific settings. Make sure you have first completed the basic Unity integration.

  • For Android, drop the network’s SDK in the following path:

    • If the network SDK is a .jar file, add it in [UNITY PROJECT ROOT]/Assets/Plugins/Android/mopub-support/libs.

    • If the network SDK is an .aar file, add it in [UNITY PROJECT ROOT]/Assets/Plugins/Android.

  • For iOS, add network SDK frameworks only after the project has been exported to Xcode.

Review the MoPubDemoGUI.cs in the MoPub Unity sample app to pass ad unit IDs. The following is one example of how you can do this:

  private string[] _bannerAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
  private string[] _interstitialAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
  private string[] _rewardedVideoAdUnits = new string[] {[YOUR_AD_UNIT_ID]};
  private string[] _rewardedRichMediaAdUnits = new string[] {[YOUR_AD_UNIT_ID]};

Mediation adapters for Unsupported Ad Networks

Android

  1. Follow the instructions to build mediation adapters for Android to write the mediation adapter class for Android.

  2. Add the mediated network’s SDK to the correct directory. Refer to the section above for the appropriate paths.

  3. Add the mediation adapters (as .jar files) to [UNITY PROJECT ROOT]/Assets/Plugins/Android/mopub-support/libs. For ease of maintenance, we recommend keeping the mediation adapter classes and the network SDKs as separate .jar files.

iOS

  1. Follow the instructions to build mediation adapters for iOS to write the mediation adapter class for iOS.

  2. Create a separate folder in [UNITY PROJECT ROOT]/Assets/Editor/MoPub/NativeCode and add the SDKs and mediation adapter files directly.

Troubleshooting

  • For a complete example of how to add ads into your app, check out the MoPubDemoScene in Assets/Scenes/.

  • You can also test the MoPubDemoScene for both iOS and Android.

  • Starting with Unity Editor v5.0.2f1, occasionally the static libraries are not added to the Build Phase settings correctly. If you encounter a build error about missing frameworks or libraries, remove and re-add them manually.

  • For mediating AdColony through MoPub’s Unity wrappers, install the AdColony Unity Plugin to receive ads from the AdColony SDK. This has a special version of the Android AdColony SDK without native libraries for unsupported Unity architectures.

  • We do not recommend sending concurrent ad requests using the same ad units or multiple ad units at this time.

Last updated June 09, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)