Set up Unity

Download TentuPlay Unity SDK

Import TentuPlay Unity SDK

  1. Run the Unity editor.

  2. Click Assets  Import Package  Custom Package.

    Getting started sdk import unity1 KR
  3. Select the downloaded TentuPlay_SDK_v2021.4_DemoGame.unitypackage and click Open.

    image (46)
  4. Click Import in the Import Unity Package window to install TentuPlay package.

    image (34)

    TentuPlay Unity package has the following components:

    ShingGoongDemo

    You can learn how to use TentuPlay SDK through the demo game.

    TentuPlay

    The core of TentuPlay. Dll files, scripts and prefabs are included.

    Plugins

    3rd party plugins to run TentuPlay.

    TPPersonalizedOfferTemplates

    The template scripts and prefabs provided for the TentuPlay offer UI.

  5. After installation, TentuPlay menu will be created in Unity Editor menu, and TentuPlay folder will be created in Assets folder.

    image (35)

Configure TentuPlay settings

TentuPlay SDK settings can be done either in Unity Editor or using a script.

If using Unity editor

  1. Click TentuPlay  Edit Settings from the menu bar.

    image (36)
  2. Configure the following setttings:

    • Api Key: The TentuPlay API Key for the authentication.

    • Secret: The TentuPlay API Secret Key the authentication.

      You can create or get your project credentials such as Api Key and Secret key from TentuPlay Console > Project > Project Settings > General > Project Credentials.

    • Get Client Key: Get your Client Key by clicking the button. Client Key is a must for TentuPlay.

    • TentuPlay Debug Mode: Select this option to debug TentuPlay. Turn this option off for the deploy build. It may be redundant.

    • Auto Upload: Select this option to automatically upload data from clients' devices to the server

      • Auto Upload must be selected to upload data automatically. If Auto Upload is not selected, you must call the UploadData` method to upload data.

      • TentuPlay functions can only be called in the main thread, If it is impossible to call within the main thread, turn off Auto Upload and use TPUploadData and update manually.

    • Upload Interval (sec): The minimum interval for the upload. (Default value is set to 1200, Maximum: 3600)

    • Offer Sync Interval (sec): Minimum offer sync interval (default is 600 seconds) when using TentuPlay CRM

If using a script

Assign static fields of TentuPlaySettings class prior to the very first TentuPlay Class declaration, and you can configure TentuPlay Settings without TentuPlaySettings.asset.

Script example
using TentuPlay;
TentuPlaySettings.ClientKey= "MY_CLIENT_KEY";
TentuPlaySettings.DEBUG = true; // Default is false
TentuPlaySettings.AutoUpload = true;
TentuPlaySettings.DeferredSendIntervalSec = 1200; // Default is 1200
TentuPlaySettings.OffersGetInterval= 600;

// The first class or method called.

You can get your Client Key from CreateClientKey(string apiKey, string secret) method in TentuPlaySettingsEditor class.

Do not hardcode your Api Key and Secret Key in your code.