Skip to content

Quick Start

This document provides the shortest integration path for the Unity RUM SDK, helping you complete a verifiable data upload with minimal steps.

Prerequisites

Before you begin, complete the following preparations:

  1. In Real User Monitoring (RUM), create a Unity Android app and a Unity iOS app, and obtain the corresponding App ID
  2. Confirm the upload URL and authentication method:
  3. Local environment deployment: prepare datakitUrl
  4. Public network DataWay: prepare datawayUrl and clientToken
  5. Confirm the project has imported ft-sdk-unity.unitypackage
  6. Confirm the project has installed "com.unity.nuget.newtonsoft-json"

Integration Steps

  1. Drag FTSDK.prefab into the first scene
  2. Call FTUnityBridge.Install(...) when the application starts
  3. Initialize RUMConfig and pass the corresponding App ID for Android and iOS
  4. Initialize LogConfig and TraceConfig as needed
  5. Run the application and trigger a page open, log output, or network request
  6. In the Unity console and the TrueWatch platform, confirm that the data has been successfully uploaded

Minimal Initialization Example

FTUnityBridge.Install(new SDKConfig
{
    // Use datakitUrl for local environment deployment
    datakitUrl = "http://10.0.0.1:9529",
    // For public network DataWay, use datawayUrl + clientToken
    // datawayUrl = "https://open.dataway.url",
    // clientToken = "client-token",
    env = "prod",
    debug = true,
});

FTUnityBridge.InitRUMConfig(new RUMConfig
{
    androidAppId = "androidAppId",
    iOSAppId = "iOSAppId",
    sampleRate = 1.0f,
});

Choose either datakitUrl or datawayUrl; if you use the public network DataWay, also pass clientToken.

Optional: Initialize Log and Trace

FTUnityBridge.InitLogConfig(new LogConfig
{
    enableCustomLog = true,
    enableLinkRumData = true,
    sampleRate = 1.0f,
});

FTUnityBridge.InitTraceConfig(new TraceConfig
{
    enableNativeAutoTrace = true,
    enableLinkRumData = true,
    sampleRate = 1.0f,
});

Optional: Add Unity Exception Listener

If you want Unity exceptions to be converted into RUM Error, listen to Application.logMessageReceived:

void OnEnable()
{
    Application.logMessageReceived += LogCallBack;
}

void OnDisable()
{
    Application.logMessageReceived -= LogCallBack;
}

void LogCallBack(string condition, string stackTrace, LogType type)
{
    if (type == LogType.Exception)
    {
        FTUnityBridge.AddError(stackTrace, condition);
    }
}

Verify the Integration

  1. Keep debug = true enabled and run the application
  2. Open a page or make a network request
  3. In the Unity console, confirm that logs related to SDK initialization and data synchronization appear
  4. Return to the TrueWatch console and confirm that the corresponding RUM data appears in the application

If you need further troubleshooting, see Troubleshooting.

Next Steps