Unreal Engine Quickstart

This plugin behaves as an Analytics Provider for Unreal Engine 5. It enables you to track in-game events using Treasure Data. Common use cases for this plugin are to track things like currency buys, item trades, and game progression

Prerequisites

  • The Unreal Engine (5.3.0) has been compiled from the current source with all dependencies so third party plugins can build.
  • The Unreal Engine has been installed on your machine.
  • Blueprints plugin is in place and enabled
  • Treasure data plugin is in place and enabled
  • You have a Treasure Data Write-Only API Key
Warning

Treasure Data strongly recommends that you use a write-only API key for ingest and import operations and whenever using Treasure Data SDKs

Click here to see how to get a write-only API Key.

  1. Login to the Treasure Data Console and go to the API Key page .
  2. If you dont already have a write-only API key, then create one. From the top right, select Actions > Create API Key .
  3. Name the new API Key.
  4. From the Type drop-down menu, select Write-only .
  5. Select Save .
  6. Copy your new Write-Only API Key and use it authenticate the APIs in your project.

Setup

Setting Up Unreal Engine

  1. Sign up for an Unreal Engine account in order to access the GitHub repository for Unreal Engine 5.
  2. On the Unreal Engine website, use the Personal > Apps and Accounts page to connect your Unreal Account to GitHub.
  3. Clone the unreal repository from GitHub to your local machine.
  4. Compile the Unreal Engine with all dependencies.

Downloading and Placing the Plugin

To get a copy of the plugin from the main GIT repository:

  1. Download the TD UE4 plugin from GitHub:
    Copy
    Copied
    git clone https://github.com/treasure-data/td-ue4-sdk
  2. Checkout the branch that matches your Unreal Engine version (UE-5.3):
    Copy
    Copied
    git checkout UE-5.3
  3. Copy the new td-ue4-sdk to your Unreal Engine plugins folder. The target path looks something like this:
    Copy
    Copied
    UnrealEngine/Engine/Plugins/td-ue4-sdk
    Info

    Alternatively, you can copy the plugin content inside your Project Plugin directory. However, this approach does not work in a Linux Development environment.

Building the Plugin

Build the td-ue4-sdk plugin

Enabling the Analytics Plugins for Your Project

  1. In the Unreal Engine 5 Editor, select Edit > Plugins .
  2. Open your project and the plugins window.
  3. Enable the two required plugins:
    • Blueprints: located at Built-in > Analytics ue4 blueprints enable
    • Treasure Data: located at Installed > Analytics ue4 td plugin enable

Configuring Project Settings

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

Copy
Copied
[Analytics]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
TDRegion=[US01,AP01,AP02,AP03,EU01]
SendInterval=10

[AnalyticsDevelopment]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
TDRegion=[US01,AP01,AP02,AP03,EU01]
SendInterval=10

[AnalyticsTest]
ProviderModuleName=TreasureData
TDApiKey=TD-WRITE-ONLY-KEY
TDDatabase=DATABASE_NAME
TDRegion=[US01,AP01,AP02,AP03,EU01]
SendInterval=10
Info

The combined length of database name and table name must be shorter than 129 chars).

After making your changes, save the file and restart the Unreal Engine editor.

Gathering Metrics with Blueprints

  1. In the Editor, select Blueprints > Open Level Blueprint .

ue4 editor 001

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

ue5 editor 001

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

Viewing data on Treasure Data

To query game events:

  1. From the Treasure Data Console , select Databases from the workbench and then open the database used in the game: Config/DefaultEngine.ini > TDDatabase .

ue4 td console 001

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 then select the Query button at the top of the screen. By default you can issue SQL queries similar to this:

Copy
Copied
SELECT * from events;

ue4 td console 002