Unity SDK 2

What you need

To use the Metica Unity SDK you need:

  • An API key, obtainable in the Metica platform

  • An appId, obtainable in the Metica platform.

  • A Max SDK Key, obtainable from Applovin platfom

Dependencies

Import the AppLovin Unity Plugin into your project by following the guide below.

Only the Import the AppLovin MAX Unity plugin step is required, the Metica SDK handles everything else. The minimum version of MAX plugin that Metica requires is 8.2.0.

Installation

In Unity, you need to import a custom package stored here:

circle-info

Before installing any new Metica .unitypackage , please remove any old Metica versions from your Assets

In Unity Editor, click on Assets -> Import Package -> Custom Package and load the .unitypackage downloaded from our repository

triangle-exclamation

Initialization

Initialize the SDK using your credentials and mediation configuration.

In MeticaInitConfig API_KEY and APP_ID are mandatory, instead, if you don't provide a USER_ID (or you pass an empty string) the Metica SDK will generate a unique UUID per player for you.

In MeticaMediationInfo provide the Max SDK Key.

InitializeAsync returns a MeticaInitResponse object. This object provides two important pieces of information:

  • SmartFloors.UserGroup – the experiment group assigned to the current player (holdout or trial).

  • SmartFloors.IsSuccess– a boolean indicating whether initialization completed successfully.

    • If this is false, the player is automatically assigned to the holdout group.

    • This flag is provided solely for analytics and logging. You do not need to implement any fallback logic, the SDK already handles holdout assignment internally.

Ad implementation

The SDK supports Banner, MREC, Interstitial and Rewarded ads. All ad operations are accessed via MeticaSdk.Ads.

Standard banner ads with auto-refresh functionality.

Banner ads auto-refresh by default. To control refresh manually these are the methods available:

MREC Ads (300x250)

Medium Rectangle ads work the same way as banners but with a larger size.

MREC ads also auto-refresh by default. Use the same refresh control methods as banners:

Interstitial Ads

Full-screen ads that are shown between content transitions.

circle-info

ShowInterstitial accepts optional placementId and customData parameters for analytics tracking.

Rewarded Ads

Reward users for watching video ads.

circle-info

ShowRewarded accepts optional placementId and customData parameters for analytics tracking.

Advanced Features

Privacy Compliance

Configure GDPR and CCPA settings before initialization.

Revenue Tracking

All ad formats provide revenue callbacks through the OnAdRevenuePaid event. The MeticaAd object contains revenue information:

AppLovin MAX Functions

The SDK provides utility functions for AppLovin MAX consent management:

Debugging

To enable debug log call MeticaSdk.SetLogEnabled(true); before initialization.

API Reference

MeticaSdk Methods

Initialization & Configuration

Method
Return Type
Description

InitializeAsync(MeticaInitConfig, MeticaMediationInfo)

Task<MeticaInitResponse>

Initializes the SDK.

SetLogEnabled(bool)

void

Enables/disables debug logging (default: false).

MeticaSdk.Ads Methods

Privacy

Method
Description

SetHasUserConsent(bool)

Sets GDPR consent status. Call before initialization.

SetDoNotSell(bool)

Sets CCPA do-not-sell flag. Call before initialization.

Method
Description

CreateBanner(string adUnitId, MeticaAdViewConfiguration config)

Creates a banner ad view.

ShowBanner(string adUnitId)

Shows a banner ad.

HideBanner(string adUnitId)

Hides a banner ad.

LoadBanner(string adUnitId)

Manually loads a banner ad (only when auto-refresh is disabled).

StartBannerAutoRefresh(string adUnitId)

Starts automatic banner refresh.

StopBannerAutoRefresh(string adUnitId)

Stops automatic banner refresh.

DestroyBanner(string adUnitId)

Destroys a banner ad view.

MREC Methods

Method
Description

CreateMrec(string adUnitId, MeticaAdViewConfiguration config)

Creates an MREC ad view.

ShowMrec(string adUnitId)

Shows an MREC ad.

HideMrec(string adUnitId)

Hides an MREC ad.

LoadMrec(string adUnitId)

Manually loads an MREC ad (only when auto-refresh is disabled).

StartMrecAutoRefresh(string adUnitId)

Starts automatic MREC refresh.

StopMrecAutoRefresh(string adUnitId)

Stops automatic MREC refresh.

DestroyMrec(string adUnitId)

Destroys an MREC ad view.

Interstitial Methods

Method
Return Type
Description

LoadInterstitial(string adUnitId)

void

Loads an interstitial ad.

ShowInterstitial(string adUnitId, string? placementId, string? customData)

void

Shows an interstitial ad with optional tracking parameters.

IsInterstitialReady(string adUnitId)

bool

Checks if interstitial is ready to show.

Rewarded Methods

Method
Return Type
Description

LoadRewarded(string adUnitId)

void

Loads a rewarded ad.

ShowRewarded(string adUnitId, string? placementId, string? customData)

void

Shows a rewarded ad with optional tracking parameters.

IsRewardedReady(string adUnitId)

bool

Checks if rewarded ad is ready to show.

MeticaSdk.Ads.Max Methods

Method
Return Type
Description

HasUserConsent()

bool

Returns whether user has consented.

IsUserConsentSet()

bool

Returns whether consent was explicitly set.

GetConsentFlowUserGeography()

MaxSdkBase.ConsentFlowUserGeography

Returns user's geography for consent flow.

MeticaAd Properties

Property
Type
Description

adUnitId

string

Ad unit identifier.

revenue

double?

Revenue generated by this ad impression (nullable).

networkName

string?

The ad network name (nullable).

placementTag

string?

Placement tag (nullable).

adFormat

string?

Ad format type (nullable).

creativeId

string?

Creative identifier (nullable).

latency

long?

Load latency in milliseconds (nullable).

MeticaAdError Properties

Property
Type
Description

message

string

Error message.

adUnitId

string?

Associated ad unit identifier (nullable).

MeticaAdViewPosition Enum

Position options for banner and MREC ads:

Value
Description

TopCenter

Top center of the screen.

Centered

Center of the screen.

BottomCenter

Bottom center of the screen.

MeticaMediationType Enum

Supported mediation platforms:

Value
Description

MAX

AppLovin MAX mediation platform.

MeticaAdsCallbacks Events

Event
Type
Description

MeticaAdsCallbacks.Banner.OnAdLoadSuccess

Action<MeticaAd>

Banner ad loaded successfully.

MeticaAdsCallbacks.Banner.OnAdLoadFailed

Action<MeticaAdError>

Banner ad failed to load.

MeticaAdsCallbacks.Banner.OnAdClicked

Action<MeticaAd>

Banner ad was clicked.

MeticaAdsCallbacks.Banner.OnAdRevenuePaid

Action<MeticaAd>

Banner ad revenue was recorded.

MREC Callbacks

Event
Type
Description

MeticaAdsCallbacks.Mrec.OnAdLoadSuccess

Action<MeticaAd>

MREC ad loaded successfully.

MeticaAdsCallbacks.Mrec.OnAdLoadFailed

Action<MeticaAdError>

MREC ad failed to load.

MeticaAdsCallbacks.Mrec.OnAdClicked

Action<MeticaAd>

MREC ad was clicked.

MeticaAdsCallbacks.Mrec.OnAdRevenuePaid

Action<MeticaAd>

MREC ad revenue was recorded.

Interstitial Callbacks

Event
Type
Description

MeticaAdsCallbacks.Interstitial.OnAdLoadSuccess

Action<MeticaAd>

Interstitial ad loaded successfully.

MeticaAdsCallbacks.Interstitial.OnAdLoadFailed

Action<MeticaAdError>

Interstitial ad failed to load.

MeticaAdsCallbacks.Interstitial.OnAdShowSuccess

Action<MeticaAd>

Interstitial ad displayed successfully.

MeticaAdsCallbacks.Interstitial.OnAdShowFailed

Action<MeticaAd, MeticaAdError>

Interstitial ad failed to display.

MeticaAdsCallbacks.Interstitial.OnAdHidden

Action<MeticaAd>

Interstitial ad was dismissed.

MeticaAdsCallbacks.Interstitial.OnAdClicked

Action<MeticaAd>

Interstitial ad was clicked.

MeticaAdsCallbacks.Interstitial.OnAdRevenuePaid

Action<MeticaAd>

Interstitial ad revenue was recorded.

Rewarded Callbacks

Event
Type
Description

MeticaAdsCallbacks.Rewarded.OnAdLoadSuccess

Action<MeticaAd>

Rewarded ad loaded successfully.

MeticaAdsCallbacks.Rewarded.OnAdLoadFailed

Action<MeticaAdError>

Rewarded ad failed to load.

MeticaAdsCallbacks.Rewarded.OnAdShowSuccess

Action<MeticaAd>

Rewarded ad displayed successfully.

MeticaAdsCallbacks.Rewarded.OnAdShowFailed

Action<MeticaAd, MeticaAdError>

Rewarded ad failed to display.

MeticaAdsCallbacks.Rewarded.OnAdHidden

Action<MeticaAd>

Rewarded ad was dismissed.

MeticaAdsCallbacks.Rewarded.OnAdClicked

Action<MeticaAd>

Rewarded ad was clicked.

MeticaAdsCallbacks.Rewarded.OnAdRewarded

Action<MeticaAd>

User earned the reward.

MeticaAdsCallbacks.Rewarded.OnAdRevenuePaid

Action<MeticaAd>

Rewarded ad revenue was recorded.

Troubleshooting

Max SDK Conflict

The Metica Unity SDK already includes and manages the AppLovin MAX integration internally. Do not reference, call, or initialize MaxSdk or subscribe to MAX callbacks directly in your code, this includes any callbacks related to:

  • SDK initialization

  • Banner

  • MREC

  • Interstitial

  • Rewarded

Direct usage of MAX APIs or subscribing to MAX events can cause version conflicts, duplicate initialization, callback collisions, or unexpected behavior. Instead, rely on the callbacks exposed by the Metica SDK for all ad lifecycle events.

Moloco SDK Version

Moloco’s libraries (SDK and adapters) must be kept up to date to avoid dependency and build issues when used alongside Metica’s mediation setup.

  • Ensure the Moloco SDK and its adapters are at least version 4.3.0 or above.

Older Moloco versions may lead to dependency resolution issues and incompatibilities with other mediation components.

Last updated

Was this helpful?