Unity SDK

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.

Installation

In Unity, open the Package Manager (Window > Package Manager) and click on the '+' button in the top left corner. Select "Add package from git URL..." and enter the following:

https://github.com/meticalabs/metica-unity-sdk.git

How to use the Metica SDK

The recommended way to use the SDK is through MeticaSdk which offers async/await methods alongside coroutine ones.

For backwards compatibility the old deprecated mechanism is still available which has only the coroutine approach: MeticaAPI

You can retrieve an instance of IMeticaSdk with

private IMeticaSdk _sdk = MeticaSdk.SDK;

Setup

The SDK configuration exposes the following parameters:

Property
Description

apiKey

Your API key

appId

The application identifier accessible from Metica's dashboard.

userId

A string that identifies a user. This can change during the lifetime of your app/game so, for example and depending on your needs, this could be a temporary id that later becomes a specific userId, or it can be the current user's id if it's already identified.

Interstitial Ads

Interstitial ads are full-screen or full-page ads that temporarily cover an app’s interface. They’re typically shown at natural pauses or transition points, such as after completing a level in a game or when navigating between major views.

The following sections show you how to load and then show an interstitial ad.

Loading an Interstitial ad

The following code shows you how to attach listeners and load the first interstitial ad:

Showing an Interstitial Ad

To show an interstitial ad, call ShowInterstitial():

Rewarded Ads

Rewarded ads are video ads that users can choose to watch in exchange for in-app rewards.

Loading a Rewarded Ad

The InitializeRewardedAds method attaches listeners for both Metica and MAX SDK rewarded ad callbacks and then loads the first rewarded ad.

Showing a Rewarded Ad

To show an interstitial ad, call ShowRewarded():

Purchase Event

To enhance the integration experience, it's crucial to share additional information with Metica, such as in-app purchase details. The Metica SDK offers a method to log a purchase event. This event includes the product's unique ID, the currency code, the total amount, and an optional custom payload for developers to add personalized data.

Last updated

Was this helpful?