Kiip Unity Wrapper Documentation

Overview

Wrapper documentation is provided as a reference for implementing the Kiip SDK into a Unity projects.

This wrapper is open source. To make changes, please open a pull request on the repository.

Package Contents

The Unity package contains both the iOS and Android SDK. Currently, the iOS SDK version included is 2.3.0. The Android version is 2.3.1.

Kiip Prefab

The Kiip Prefab enables the input of the iOS or Android app key and secret right from the inspector pane.

Copy and Paste

Kiip Object

The Kiip object enables the attaching of user information without user intervention. For example, if the user’s e-mail address is already know, the reward unit can be pre-populate with this information.

The Kiip Object contains the following properties that can be set:

public bool shouldAutoRotate
public DeviceOrientation interfaceOrientation
public string email
public string userId
public string gender
public DateTime birthday
public bool testMode

The Kiip Object contains the following methods that can be called:

public static void saveMoment( string momentID )
public static void saveMoment( string momentID, double val)
public static void showPoptart()

Calling a saveMoment method is used to specify the event in which to deliver a reward.

Events

KiipEvents.cs contains events used to listen in on sessions and rewards.

Session Events

public static event Action sessionStartedEvent;
public static event Action<string> sessionFailedToStartEvent;

sessionStartedEvent

This event is fired after a Kiip session starts.

sessionFailedToStartEvent

Called if sessionStartedEvent fails. String: error string describing what went wrong.

Moment Events

Listen to these events so you’ll have a chance to execute something before the reward is shown. Typically for lowering game volume, ensuring the correct UI is present in the background, etc.

public static event Action onSaveMomentFinishedEvent;
public static event Action<string> onSaveMomentFailedEvent;
public static event Action onShowModalEvent;
public static event Action onDismissModalEvent;
public static event Action onShowPoptartEvent;
public static event Action onDismissPoptartEvent;
public static event Action onVideoShowEvent;
public static event Action onVideoDismissEvent;

onSaveMomentFinishedEvent

Called after a successful moment save. This is called whether or not there is a reward to show.

onSaveMomentFailedEvent

Handles error. String: error string describing what went wrong.

onShowModalEvent

Called when a full screen interstitial appears.

onDismissModalEvent

Called when a full screen interstitial disappears.

onShowPoptartEvent

Called when the reward workflow starts.

onDismissPoptartEvent

Called when the entire reward workflow has ended.

onVideoShowEvent

Called when a video reward will play.

onVideoDismissEvent

Called when a video is finished (via user or completion).

Virtual Currency

Content : The amount of content to provide a user after a successful redeem. This is used when rewards contain in-game currency delivery.

public static event Action<Content> onContentEvent;

Scripts

The Kiip SDK calls are written in C#. If using Javascript to make Kiip SDK calls, make sure the Kiip script remains in the “Plugins” folder, as Unity compiles scripts found there first.

Utilize the GetComponent method to communicate with the Kiip SDK from Javascript. View the following example for a quick reference.

var MyCSharpScript : Kiip = GetComponent( Kiip );
MyCSharpScript.saveMoment( 'level-up' );

Moments

Moments can be called anywhere. Like the standalone iOS and Android SDKs, the saveMoment method is overloaded to allow for an optional argument.

string momentID // *required* An arbitrary string you create that automatically registers with the Kiip system.

Custom Notifications

The Kiip SDK allows you to attach an asset or element when you show a notification view. This promotes a higher level of immersion for your app’s UX.

To create custom notification, design a simple UI button element for users to tap or click.

Example Notification

Example Notification

Once created, show your notification within the onSaveMomentFinishedEvent Kiip event. Make sure showPoptart() has been added to your UI button’s onClick method.

Need Help?

We’re happy to answer any questions about integrating Kiip. Check out our FAQ or email us.