Unity Mediation with Start.io SDK
This document is intended for Unity developers using Ad Mediation for monetization, such as AdMob, AppLovin, or LevelPlay (IronSource), and are looking to include Start.io as part of their mediated waterfall.
Steps to Follow
Step 1: Use Proper Mediation Adapter
- Ensure you use the correct AdMob, AppLovin, or IronSource mediation adapter in your application.
- If you're not using a mediation platform and just want to integrate the Start.io SDK, follow this Unity wrapper integration guide.
Step 2: Configure Mediation
- Make sure your mediation is properly configured in your AdMob, AppLovin, or LevelPlay account.
- Verify that you can observe their test ads in your project.
Step 3: Integrate Start.io SDK into Unity Mediation
External Dependency Manager for Unity (EDM4U)
- EDM4U is an open-source tool that handles native dependencies for you.
- Useful if you are already using EDM4U to include other dependencies in your project.
- EDM4U automatically resolves all dependencies declared in a specific XML file:
- For iOS: Adds respective entries to your Podfile.
- For Android: Adds respective entries to your
mainTemplate.gradle
. If you don't have one, EDM4U will download the raw dependencies and include them in your project.
Download and Import EDM4U
If you're already using EDM4U, skip to "Declare mediated networks dependencies with EDM4U".
To download and import the latest version of EDM4U:
- Download from this link or follow Google's installation instructions.
- Recommended modern installation method:
- Use npm from Node.js (install it if you don't have it: Node.js download).
- Install OpenUPM-CLI using npm (OpenUPM-CLI instructions).
- Install EDM4U using OpenUPM:
openupm add com.google.external-dependency-manager
.
Reload Unity Editor (close and reopen the project). Follow prompts to "Add Selected Registries", "Apply", etc. If installed properly, you'll find "External Dependency Manager" under the "Assets" menu.
Declare Mediated Networks Dependencies with EDM4U
-
- Create a new XML file. The filename can be anything, as long as it ends with
Dependencies.xml
(e.g.,StartioDependencies.xml
). - Place this file in a folder named
Editor
. - Copy the following content into the file:
- Create a new XML file. The filename can be anything, as long as it ends with
<?xml version="1.0" encoding="utf-8"?> <dependencies> <androidPackages> <androidPackage spec="com.startapp:ironsource-mediation:2.+" /> </androidPackages> <iosPods> <iosPod name="startio-ironsource-mediation" version="~> 1.1" bitcodeEnabled="true" minTargetSdk="11.0" addToAllTargets="false" /> </iosPods> </dependencies>
If you build for only one platform, use <androidPackages>
or <iosPods>
accordingly and remove the other.
Dependencies should resolve automatically. You can force the dependency resolution by clicking Assets > External Dependency Manager > Android Resolver > Force Resolve
.
Supported Mediation Platforms
Select the proper dependency according to your mediation host:
- LevelPlay (IronSource)
- Android:
com.startapp:ironsource-mediation:2.+
- iOS:
startio-ironsource-mediation ~> 1.1
- Android:
- AdMob
- Android:
com.startapp:admob-mediation:3.+
- iOS:
startio-admob-mediation ~> 3.0
- Android:
- AppLovin MAX
- Android:
com.startapp:applovin-mediation:2.+
- iOS:
startio-applovin-mediation ~> 2.0
- Android:
Troubleshooting Common Issues
Unity 2022 (LTS) Gradle Issue
Many Unity 2022 versions use an old Gradle version (5.1.1), leading to errors like: java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
.
To resolve:
- Go to your project folder >
Temp > PlayServicesResolverGradle > gradle > wrapper > gradle-wrapper.properties
. - Change Gradle to a newer version (e.g.,
gradle-8.2-all.zip
). - Note: Unity cleans the Temp folder on close. Repeat this step when reopening the project.
- Delete
Assets > Plugins > Android
andAndroid.meta
. - Press
Resolve
again.
Your Unity app is now ready!