Unity Campaigns SDK

SDK Integration

Here you can find short video instruction.

Installation

Ensure git is installed. In Unity, click `Window > Package Manager. Click the plus + sign and select 'Add package from Git URL' Type in the URL:

Install mix panel first from repository
You don't need to do anything with Mixpanel. Monetizr SDK will handle all setup.

Get your Monetizr SDK package here

333333

Teaser on the game main menu.

SDK Initialization

SDK initialization. MonetizrManager.Initialize method must be called before using MonetizrManager. It starts preloading assets in the background and call onRequestComplete when it will be completed. soundSwitch method should be assigned to turn off in game sounds during the ads.

MonetizrManager.Initialize(string apiKey, Action<bool> onRequestComplete, Action<bool> soundSwitch);

Additional setup

After initialization it makes sense to setup teaser screen position on the screen with MonetizrManager.SetTeaserPosition

MonetizrManager.SetTeaserPosition(new Vector2(-420, 270));

Connect in-game coins with Monetizr SDK by calling MonetizrManager.SetGameCoinAsset:

MonetizrManager.SetGameCoinAsset(RewardType.Coins,defaultRewardIcon, "Coins", () =>
{
  //should be defined by developer
    return GameController.I.GetCoinsTotal();
},
(int reward) =>
{   
  //should be defined by developer
    GameController.I.AddCoinsTotal(reward);
});

Main menu teaser-banner visibility

Preferable and easiest way how to change banner visibility is to add TeaserHelper script on Main Menu UI (or other UI element that will be visible among with the banner) object root and functions mentioned above will be called automatically.

Otherwise use the following methods to show and hide menu banner manually. Banner should be visible in the main menu and should be hidden when other in-game popup appears, e.g. Options, Shop, etc. Also, it should hidden during the game play.

MonetizrManager.HideTinyMenuTeaser();

MonetizrManager.ShowTinyMenuTeaser();

Problems

  • If teaser isn't clickable - check if you have EventSystem in your scene
  • If teaser doesn't show up - for testing purposes you can clean local data with Monetizr/Clear local data in the top menu

Did this page help you?