Install and configure the Unity Mediation package

To install the Unity Mediation package, follow these steps:

  1. Download the tarball for the latest version of the Unity Mediation (Beta) SDK.

    Note: Do not extract the package after you download it. Or, if you already have an earlier version of the Unity Mediation SDK installed, update to the latest version of the SDK from the Package Manager.
  2. Open your project in the Unity Editor and go to Window > Package Manager.

  3. In the Package Manager, select + > Add package from tarball.

  4. Select the Unity Mediation package from your computer, and then select Open.

Another option is to edit your project’s manifest.json (located under Packages/manifest.json). In the dependencies section, add the line: "": "0.4.1-preview.1".

After a successful installation, the Mediation package is visible in the list of downloaded packages in the Package Manager (Window > Package Manager).

Import ad network adapters

Open your project in the Unity Editor and select Edit > Project Settings > Services > Mediation or Services > Mediation > Configure.

Enable the adapters for each of your respective Ad Sources. For more information, see Configure an Ad Source.

Note that the following adapters require additional steps to function correctly in your app. If these requirements are not fulfilled, your app will not open and your builds will crash:

  • AdMob requires unique identifiers for each platform. You can locate these IDs in the AdMob dashboard, as detailed in the Ad Source Configuration guide.

  • Unity Ads requires that you remove any previous installations of the Unity Ads package (either from the Package Manager or from the Asset store).

Applying your adapter settings in the Unity Editor creates a file in your project files (Assets/Editor/MediationAdapterDependencies.xml) that contains mediation dependencies based on your selection of network adapters.

Set specific dependency versions by using XML override

When you install your selected ad network adapters from the Mediation Services window in the Unity Editor, the latest, most compatible version of the adapter SDK is installed automatically. However, there might be instances where you need to manually declare third-party adapters and the respective adapter versions you’ll use in your project, such as when:

  • You are forced to use the latest Xcode due to the newest third-party ad network dependencies, but can’t currently upgrade (for example, because of system incompatibilities)

  • You want to avoid using a newer version of Android, AndroidX, or Gradle

  • There is a dependency patch was release with breaking API changes

  • There is a dependency with a valid version that was released with major issues

  • A bug in CocoaPods/Gradle means resolvable dependency tree remains unsolvable (this is an unlikely scenario)

In either of these cases, do the following to manually add any third-party ad network SDK version and ensure compatibility in your project:

  1. Create a Dependency Override XML file, then name it OverrideDependencies.xml.

  2. Include this file in your project’s Assets/Editor folder.

Use the following format for the OverrideDependencies.xml file:

      <androidPackage spec="adapterName:version"/>  
      <iosPod name="adapterName" version="x.x.x">

Install the iOS Support package

To facilitate the implementation of iOS 14.5 requirements (for example, showing a permission popup to request that the user be tracked, and the attribution of shown ads by using SKAdNetworkIds), we recommend that you install the iOS Support package. For more information, see Installing the iOS 14 support package.

If the iOS Support package is installed, then by default, Unity Mediation and the iOS Support package will include all SKAdNetworkIds that are required for the Unity Mediation package, and the list of SKAdNetworkIds will be updated at each build with the latest required SKAdNetworkIds (this is because they are included in the Info.plist of the iOS project).

Resolve dependencies

Games made with Unity require the Play Services Resolver to resolve platform-specific dependencies. We recommend that you use the Play Services Resolver included with the Mediation package for best results. To do so:

  1. Remove any previously installed version of Play Services Resolver or EDM4U.

  2. Accept when the package offers to install the Play Services Resolver, and the Unity Mediation package version of Play Services Resolver will be installed.

    If the Mediation package detects that resolution is necessary, you are prompted to resolve dependencies when you attempt to build an unresolved project.

To access the Play Services Resolver in the Unity Editor, select Assets > Play Services Resolver, and then select the platform.

For Android, if the Enable Auto-Resolution and Enable Resolution On Build settings are both set to OFF, you need to manually resolve dependencies. If either setting is ON, dependencies automatically resolve.

Tip: View this video on how to resolve external dependencies in your project within the Unity Editor.