Unity Integration

MAS can be integrated in 2 different ways:

Prerequisites

  1. MAS supports Unity LTS versions from 2018 and above
  2. To deploy to Android, you need to target API 19+
  3. To deploy to iOS, you need to use Xcode 12.5+ and Cocoapods 1.10.0+
  4. Please remove any old MAS version from your project before upgrading to 4.4+
  5. If you use Proguard, make sure to read this
  6. Please make sure to check the Unity Samples and video tutorials to aid your integration

1. Download the Correct Unity Plugin

MAS provides 2 versions of the Unity plugin, and you need to select one depending on your game:

  • If your game is not part of the “Designed for Families Program”, please use the Standard MAS Plugin.
  • If your game is a part of Google Play’s “Designed for Families” program, you will need to use the Designed For Families plugin in order to comply with the program’s requirements.

Note: If you are using Unity 2018, please make sure to read this.

Note: To build for iOS, you need to use MAS 4.3.2+ and update your iOS resolver settings under External Dependency Manger -> iOS Resolver:

2. Integrate the SDK Into Your Project

Open your Unity project and import the Unity package. Double click the compressed package icon. The files will auto-populate as illustrated below.

Important! The MAS Unity Plugin is built for Android & iOS platforms. Please run your projects on Android and/or iOS devices to test ads when integration is complete.

3. Enter Application Information

If you’re using MAS 4.4.5+, this step is optional if your game is already live and you have provided the store link when adding your game in MAS dashboard.

If you’re using any older MAS version or if you haven’t provided the store link, you’ll need to add your Appkey (generated in the game submission process) manually.

In order to do it, you can use the configuration wizard provided by our SDK. You can access it through Assets/Yodo1/MAS Settings.

You will need to copy the AppKey from the dashboard and add it into the configuration fields. The Admob ID should be fetched automatically, but if it’s not the case you can add it manually.

3.1 Set Android Configuration

3.2 Set iOS Configuration

4. Comply With Legal Frameworks

Please comply with all legal frameworks that apply to your game and its users. You can find references to major legal frameworks and details about how to comply with them while using MAS through these links:

If you’re using MAS 4.3.0+, you can enable the built-in privacy compliance dialog in the SDK to collect user information and consent. Here is a picture of the pop up:


You can add this to your game with the code below, and you can also customize it. Use the following steps:

  1. Enable (Before the initialization)
Yodo1AdBuildConfig config = new Yodo1AdBuildConfig().enableUserPrivacyDialog(true);  
Yodo1U3dMas.SetAdBuildConfig(config);
  1. Custom user agreement (optional)
Yodo1AdBuildConfig config = new Yodo1AdBuildConfig().enableUserPrivacyDialog(true).userAgreementUrl("Your user agreement url");  
Yodo1U3dMas.SetAdBuildConfig(config);
  1. Custom privacy policy (optional)
Yodo1AdBuildConfig config = new Yodo1AdBuildConfig().enableUserPrivacyDialog(true).privacyPolicyUrl("Your privacy policy url");  
Yodo1U3dMas.SetAdBuildConfig(config);

4. Customize the appearance of the pop up(optional). The pop up is divided into 3 sections:

  • You can customize the background color of the 3 highlighted areas.
  • You can customize the the top text, button text, and black font text in the content area.
Yodo1MasUserPrivacyConfig userPrivacyConfig = new Yodo1MasUserPrivacyConfig()
            .titleBackgroundColor(Color.green)
            .titleTextColor(Color.blue)
            .contentBackgroundColor(Color.black)
            .contentTextColor(Color.white)
            .buttonBackgroundColor(Color.red)
            .buttonTextColor(Color.green);

IMPORTANT! Failure to comply with these frameworks can lead the Apple App Store and/or Google Play Store rejecting your game, as well as a negative impact of your game’s monetization.

5. Initialize the SDK

6.1 Include the following line at the top of the file where you initialize the MAS SDK:

using Yodo1.MAS;


6.2 Initialize the using SDK the Start method.

void Start()  {
  Yodo1U3dMas.InitializeSdk();
}

6. Select Ad Formats To Implement

Banners are rectangular image or text ads that occupy a spot within an app’s layout. They stay on screen while users are interacting with the app.

Interstitial

Interstitials are full-screen ads that cover the interface of an app until closed by the user. They’re best used at natural pauses in the flow of an app’s execution, such as in between levels of a game or after completing a task.

Rewarded Video

Rewarded video ads are full-screen video ads that users have the option of watching in full in exchange for in-app rewards.

7. Set Up Your App-Ads.txt File

Click here for details!

Updated on January 18, 2022

Was this article helpful?

Related Articles