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 starting, please complete the following preparations:

  1. Create Unity Android and Unity iOS applications in RUM respectively, and obtain the corresponding App ID.
  2. Confirm the upload address and authentication method:
  3. Local environment deployment: Prepare datakitUrl.
  4. Public DataWay: Prepare datawayUrl and clientToken.
  5. Confirm that ft-sdk-unity.unitypackage has been imported into the project.
  6. Confirm that "com.unity.nuget.newtonsoft-json" is installed in the project.

Integration Steps

  1. Drag and drop FTSDK.prefab into the first scene.
  2. Call FTUnityBridge.Install(...) when the application starts.
  3. Initialize RUMConfig and pass in the App ID corresponding to Android and iOS.
  4. Initialize LogConfig and TraceConfig as needed.
  5. Run the application and trigger a page view, log print, or network request.
  6. Confirm in the Unity console and the Guance platform 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",
    // Use datawayUrl + clientToken for public DataWay
    // datawayUrl = "https://open.dataway.url",
    // clientToken = "client-token",
    env = "prod",
    debug = true,
});

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

Either datakitUrl or datawayUrl is sufficient. If using the public DataWay, please also pass in 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: Supplement Unity Exception Listening

If you want to convert Unity exceptions into RUM Errors, you can 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 Integration Success

  1. Keep debug = true enabled and run the application.
  2. Open a page or initiate a network request.
  3. Confirm in the Unity console that logs related to SDK initialization and data synchronization appear.
  4. Return to the Guance console and confirm that corresponding RUM data has appeared in the application.

If further troubleshooting is needed, please refer to Troubleshooting.

Next Steps