04. Unity-Plugin Guide

Development environment

Unity

2022.3.11f1

Java SDK (Java 11)

ONE AdMax SDK v1.2.1

Requirements

  • Unity 2022.3.11f1 or higher

  • Android SDK version

    • Minimum API Level 16 or higher

    • Target API Level 33 or higher

The Android API level can be configured in Project Settings > Player > Other Settings.

Importing ONE AdMax for Unity Plugin

In the Unity menu bar, click Assets > Import Package > Custom Package.

The Assets/OneStoreCorpPlugins/com.oneadmax.global folder will be created.

EDM4U(External Dependency Manager for Unity) is distributed as a required component. If you are already using it, uncheck ExternalDependencyManager during the Import Package step before proceeding.

Include external dependencies

To include repositories and dependencies in your project, follow these steps: Project Settings > Player > Publishing Settings > Build

  • Custom Main Manifest

  • Custom Main Gradle Template

  • Custom Gradle Settings Template

Go to Assets > External Dependency Manager > Android Resolver > Force Resolve and select it.

The Maven Repository URL will be applied to the settingsTemplate.gradle file.

The Maven Module will be applied to the mainTemplate.gradle file.

The dependencies for the ONEAdMax for Unity plugin are listed in the following file: Assets/OneStoreCorpPlugins/com.oneadmax.global/Editor/ONEAdMaxDependencies.xml


Issuing and applying the media key

01. How to Issue a Media Key

If you have received the media key, you need to configure the <meta-data /> in the AndroidManifest.xml file.

<manifest>
    ...
    <application>
        ...
        <activity android:name="com.unity3d.player.UnityPlayerActivity">
            ...
        </activity>

        <meta-data android:name="com.oneadmax.global.appkey" android:value="your app key"/>
    </application>
</manifest>

SDK required permissions

<manifest>
    ...
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    ...
</manifest>

SDK Initialize

Before loading ads, the app must initialize ONEAdMax. The initialization with ONEAdMaxClient.Initialize() should be done only once.

...
using ONEAdMax;
...
public class ONEAdMaxDemo : MonoBehaviour
{
    private static bool _isInitialized = false;
    
    void Start()
    {
        if (!_isInitialized)
        {
            // Initialize the ONEAdMax SDK.
            ONEAdMaxClient.Initialize(() =>
            {
                // This callback is called once the ONEAdMax SDK is initialized.
                _isInitialized = true
            });
        }
    }
}

Log Settings

For development, you can enable detailed logs for ONEAdMax. (default: false)

ONEAdMaxClient.SetLogEnable(true);

GDPR Settings

To comply with the EU's GDPR (General Data Protection Regulation), the following API is added. Please call the API only for users who require GDPR consent. (default: true)

ONEAdMaxClient.GdprConsentAvailable(true);

COPPA Settings

To comply with the COPPA (Children's Online Privacy Protection Act), the following API is added. On such devices, all ad requests will result in "No ad" being served. (default: false)

ONEAdMaxClient.tagForChildDirectedTreatment(false);

Application Quit

When the application is closed, it releases the resources allocated in memory (such as views and memory).

void OnApplicationQuit()
{
    ONEAdMaxClient.Destroy();
}

Mediation settings

For stable Fill Rates and eCPM, it is recommended to set up a waterfall mediation.

📌Starting Mediation

Choose ad format

Rewarded Video ADs

This is a reward-based video ad. When the video ad finishes, the completion information is sent via the Complete event callback.

4-1. Rewarded Video Ads for Unity

Interstitial ADs

This is an ad that covers the entire screen of the app. Once completed or interrupted by the user, the app's screen will be displayed.

4-2. Interstitial Ads for Unity

This displays a rectangular ad that occupies part of the app's screen. You can set the position and time to automatically refresh the ad.

4-3. Banner Ads for Unity

Interstitial Video ADs (Non Reward)

This is an ad type similar to video ads, but without offering rewards.

4-4. Interstitial Video Ads for Unity (Non Reward)

Last updated