Product Documentation : Unreal Engine SDK Import Integration

You can start sending the data from your Unreal Engine app to Arm Treasure Data, using our Unreal Engine SDK. Visit the following repository for more information.

unreal engine logo

Requirements

  • Unreal Engine 4.14
  • Treasure Data Write-Only API Key (Select User > API Keys )

Getting Started

The following document assumes that the current Unreal Engine has been compiled from sources or it has all dependencies so third-party plugins can be built.

Download and Place the Plugin

Get a copy of the plugin from the main GIT repository:

Copy
Copied
$ git clone http://github.com/treasure-data/td-ue4-sdk

Copy the new td-ue4-sdk to your Engine plugins folder, the target path as follows:

Copy
Copied
UnrealEngine/Engine/Plugins/td-ue4-sdk

Alternatively, you can copy the plugin content inside your Project Plugin directory, not that this approach don't work on Linux Development environment.

Build the Plugin

To build the plugin is required to generate the build-rules, for the purpose the UE4 Engine provides a script called GenerateProjectFiles:

  • GenerateProjectFiles.bat
  • GenerateProjectFiles.sh

Depending on the system (Unix bases or Window), run the proper script from the command line:

  • If the plugin is inside the Project directory (Project/Plugins), go to the Project root directory and run the script.
  • If the plugin is inside the Engine, run the command from the Unreal Engine source root directory.

When the command finishes, type the make command:

Copy
Copied
$ make

After a few seconds, the plugin binary is available.

Speed Up Plugin Build Phase

In some cases is required to re-build only the plugin, using a normal make command can take some minutes as it does some parsing running some scripts to fix dependencies, to speed up the process the following options can be added:

Copy
Copied
$ make UE4Editor ARGS=-canskiplink

Enable the Analytics Plugins for Your Project

Inside the Unreal Engine 4 Editor, open your project and the plugins window:

  • Edit > Plugins

Now enable the two required plugins:

  • Blueprints: located at Built-in > Analytics
  • Treasure Data: located at Installed > Analytics

TD Analytics Provider

Analytics Blueprint Library

Configure Project Settings

From your project directory, open and edit the file Config/DefaultEngine.ini and append the following content at the bottom:

Copy
Copied
[Analytics]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
SendInterval=10

[AnalyticsDevelopment]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
SendInterval=10

[AnalyticsTest]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
SendInterval=10

Save the file and restart Unreal Engine Editor.

Gather Metrics Through Blueprints

In the Editor, select the Blueprints drop-down menu and select the Open Level Blueprint option:

Open Level Blueprint

Now in the Event graphs, different events can be connected to Analytics functions, as an example, the following image demonstrates how to track the Session Start, Session End, and Record Event w/Attributes events:

After a Game starts, the plugin will send the events to Treasure Data.

Treasure Data

To query the game events, go to the TD Console, select Databases, and open the database used in the game (Config/DefaultEngine.ini > TDDatabase):

Databases

By default two tables are created:

  • Sessions: start and stop sessions
  • Events: All events with or without attributes.

To query records select a table name and select the Query button. By default you can issue a SQL query as in the following example:

Copy
Copied
SELECT * from events;

Query