Monetizr Challenges SDK

Monetizr Challenges SDK for Unity

Installation

To use Monetizr SDK download the Unity package from GitHub and add it to your project using Assets/Import Package/Custom Package....

Usage

You have to create and use one instance of ChallengesClient class and use it to communicate with the Monetizr Challenges API. You also have to set the current user's information in ChallengesClient.playerInfo (at least the identifier) to use the SDK. Challenge list can be retrieved using GetList . Whenever a progress is being made by player, UpdateChallenge has to be called. When the challenge is done, a claim button must be shown in the challenge menu and ClaimChallenge must be called whenever player clicks it.

Reference

Monetizr.Challenges namespace

ChallengesClient class

Constructor(string apiKey, int timeout = 30) – creates an instance of ChallengesClient and sets the API key used by the SDK to apiKey
GetList() – gets a list of challenges available to player
GetSingle(string id) – gets a single challenges identified by id
UpdateStatus(Challenge challenge, int progress) – updates the player's progress
ClaimChallenge(Challenge challenge) – must be called when player click the claim button on a completed challenge
playerInfo – used to get and set player's information

PlayerInfo class

location – location of the current user (currently not used)
age – age of the current user (optional)
gameType – type of the game (currently not used)
playerId – a unique identifier of the user (mandatory)

Challenge class

id – identification number of the challenge (must be passed to UpdateChallenge and ClaimChallenge)
title – title of the challenge (must be visible in the challenge menu)
content – description of the challenge (must be visible in the challenge menu)
progress – players progress (must be visible in the challenge menu)
reward – type of reward when the challenge is done (0 for in-game money)
assets – a list of assets of the challenge (see Challenge.Asset)

Challenge.Asset class

id – identification number of the asset (can be ignored)
type – type of the asset (icon or banner)
title – name of the asset (can be ignored)
url – the location of the asset


Did this page help you?