Setup

Ad Mediation  provides one single interface for Ad implementation in your game.  There is no any specific action required to setup Ad Mediation API. However, before you can use mediation you need to import AD SDK's in your project, each SDK may required some setup action. You can fine setup guide for each SDK's under the Advertising Networks section.

Mediation Profiles

The priority and ad networks is defined by the Mediation profile. When you requesting the ad, mediation API will request the network with highest priority. In case the network failed to provide ad or request waiting time was to high, the Ad Mediation will switch to another network in the scope. If all network failed to load the ad, you will get failed event. You can also set the maximum ad request time in the Ad Mediation settings. If Ad network will not provide ad in specified time, mediation will send the request to another network. The default time is 10 sec. See the screenshot bellow:

There is few option how you can create and setup the medication profile.

1) You can define the mediation profile using editor Settings, you can also set profiles per platform. As showed on the screenshot bellow.

2) You can Setup mediation profile using C#, it is very useful, if for example you want to set the profile relying  not only on current platform but also on different factors like for example country code, etc. Following code snipped demonstrate the same platforms set up as on previous screenshot but using the C# implementation.

M_MediationProfile p = new M_MediationProfile();

switch(Application.platform) {
case RuntimePlatform.Android:

	p.VideoProviders.Add(M_VideoProvider.UnityAds);
	p.VideoProviders.Add(M_VideoProvider.Vungle);
	p.VideoProviders.Add(M_VideoProvider.Chartboost);

	p.InterstitialProviders.Add(M_InterstitialProvider.AdMob);
	p.InterstitialProviders.Add(M_InterstitialProvider.Chartboost);

	break;
case RuntimePlatform.IPhonePlayer:

	p.VideoProviders.Add(M_VideoProvider.Chartboost);
	p.VideoProviders.Add(M_VideoProvider.UnityAds);
	p.VideoProviders.Add(M_VideoProvider.Vungle);
	p.VideoProviders.Add(M_VideoProvider.AdColony);
	
	p.InterstitialProviders.Add(M_InterstitialProvider.iAd);
	p.InterstitialProviders.Add(M_InterstitialProvider.Chartboost);

	break;
}

M_Settings.Instance.Profiles.Add(p);
AdMediation.Instance.Init ();

Note: If you want to add mediation profiles using C# you need to do this before the AdMediation Initialization.

Continue to the Implementation guide to find out how to use the mediation API in your game.