Collect Data

ShingGoongDemo

Player (Assets/ShingGoongDemo/Scripts/TentuplayRelated/Player.cs) is a component script of Player game object that exists in ShelterScene. You can refer to the script for examples on TPStashEvent.

ShelterScene location1
ShelterScene’s location in the Folders tree
ShelterScene location2
Player game object in ShelterScene
ShelterScene location3
Player (Script) component in Player game object

SDK for Data Collection

Upon game events, call adequate methods of TPStashEvent class.

Log join events and login events

Below is an example of a script that initializes TENTUPLAY and logs the join events of new users and login events. You can collect the data by writing one line of code for each event.

using UnityEngine;
using TentuPlay;
using TentuPlay.Api; // for collecting and uploading data
using UnityEngine.UI;

public class ExampleJoinScript : MonoBehaviour
{
    // define variables
    private string player_uuid = "TentuTestPlayer";  // player_uuid as a unique identifier of a player

    // Start is called before the first frame update
    void Start()
    {
        // initialize
        TPStashEvent myStashEvent = new TPStashEvent();

        // Join method when calling a new subscription event
        myStashEvent.Join(player_uuid : player_uuid);

        // Login method when calling user's login event
        myStashEvent.PlayerLogin(player_uuid : player_uuid,
            app_version : "1.0"  // default is null. (optional)
            );

    }

}

If the data upload is successful, the events will be logged to the Unity Editor console, as shown below.

check uploads

Go to TentuPlay API Documentation for the details.

Do you need help?

Do you have questions? Join TENTUPLAY Discord if you have any questions.