# 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](https://console.treasuredata.com/app/users) Warning Treasure Data strongly recommends that you use a write-only API key for ingest and import operations and whenever using Treasure Data SDKs details summary b Click here to see how to get a write-only API Key. p div iframe script 1. Login to the Treasure Data Console and go to the [API Key page](https://console.treasuredata.com/app/mp/ak). 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. p # Setup ## Setting Up Unreal Engine 1. Sign up for an [Unreal Engine account](https://github.com/EpicGames) 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: ```bash git clone https://github.com/treasure-data/td-ue4-sdk ``` 2. Checkout the branch that matches your Unreal Engine version (UE-5.3): ```bash 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: ```bash 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 ![](/assets/ue4_blueprints_enable.864276930e4b77583d2196b342107c9bf20077d807d7d38131d6ae128da28233.bcc7a491.jpg) - Treasure Data: located at Installed > Analytics ![](/assets/ue4_td_plugin_enable.c550cc5d24ce6913a0a5b1acacd7b4d87306ff241cee0499b97c4b6f08b57a7a.bcc7a491.jpg) ## Configuring Project Settings From your project directory, open and edit the `Config/DefaultEngine.ini` file and append the following content at bottom: ``` [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**. ![](/assets/ue4_editor_001.d51bda3559cc4874b83abe838bbec3e6ce82649be6dcc1b6c96bd8212593c277.bcc7a491.jpg) 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: ![](/assets/ue5_editor_001.bde8e75527f9731353fe77fc6f644fd37a81b9d15ca16eca233debf6f7450ac9.bcc7a491.png) 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](https://console.treasuredata.com), select **Databases** from the workbench and then open the database used in the game: **Config/DefaultEngine.ini > TDDatabase**. ![](/assets/ue4_td_console_001.6bb32d01b57de69b88ae80d14382a073eb187e62f86ed72fc97f6d0924021576.bcc7a491.jpg) 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: ``` SELECT * from events; ``` ![](/assets/ue4_td_console_002.bb3df59b732190dbd68c1d1076ba426c082258b44bb85726f8036560748a2fe7.bcc7a491.jpg)