Unity Engine Integration
What’s new in 5.0
Unity developers can easily integrate the MoPub SDK along with our mediation adapters via Unity packages. We support Unity 5.5 and above. Follow these steps:
Download the latest MoPub Unity plugin here.
If you would like to use mediation, download the mediation adapters here.
MoPubUnityPlugin.unitypackageand the adapters via corresponding .unitypackage binaries into your Unity project.
- Switch back to Unity. Upon importing
MoPubUnity.unitypackage, you will see several modular jars of the new modular Android SDK for all versions 4.9.0 and newer:
mopub-sdk-*jars are required. Keep all files selected in the
Importing Packagewindow and click
Note: Native ad is currently not supported.
To mediate third-party ad networks, download the certified network SDKs here and place them in your Unity project:
SDK File Type Path to place the network SDKs Note Android (.aar)
[UNITY PROJECT ROOT]/Assets/Plugins/Android
[UNITY PROJECT ROOT]/Assets/Plugins/Android/mopub-support/libs
[UNITY PROJECT ROOT]/Assets/Plugins/iOS
Manually add the frameworks to your project after exporting it to Xcode if need be†
† Note: For publishers using MoPub plugin version 5.0+ and Unity version below 2017.1 and building for iOS should do the following: 1) Update to MoPub plugin version 5.0.1 or above. 2) After exporting your project into Xcode, select the project root folder in the left pane, then select the
Generaltab in the center pane. 3) Find the
Embedded Binariessection and click the
+button. 4) Scroll down the list of frameworks until you see Plugins/iOS/MoPubSDKFramework.framework. Select it and click
Additionally, check out this page for instructions of importing mediation adapters.
Instantiate the plugin for each ad format. You have to pass in a
Stringarray of adunit IDs to the methods as shown in the MoPubDemoGUI.cs file:
MoPub.LoadBannerPluginsForAdUnits(_bannerAdUnits); MoPub.LoadInterstitialPluginsForAdUnits(_interstitialAdUnits); MoPub.LoadRewardedVideoPluginsForAdUnits(_rewardedVideoAdUnits); MoPub.LoadRewardedVideoPluginsForAdUnits(_rewardedRichMediaAdUnits);
- Choose the format you’d like to integrate and follow the instructions for each format.
Here’s how to report a conversion/app open event:
Here’s how to enable/disable location passing:
- Plugins for the Unity engine do not mediate native ad formats.
- Developers should test to verify compatibility with other third party plugins.
Last updated July 10, 2018
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.
© 2018 MoPub Inc.