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:
- In Real User Monitoring (RUM), create a Unity Android app and a Unity iOS app, and obtain the corresponding
App ID - Confirm the upload URL and authentication method:
- Local environment deployment: prepare
datakitUrl - Public network DataWay: prepare
datawayUrlandclientToken - Confirm the project has imported
ft-sdk-unity.unitypackage - Confirm the project has installed
"com.unity.nuget.newtonsoft-json"
Integration Steps¶
- Drag
FTSDK.prefabinto the first scene - Call
FTUnityBridge.Install(...)when the application starts - Initialize
RUMConfigand pass the correspondingApp IDfor Android and iOS - Initialize
LogConfigandTraceConfigas needed - Run the application and trigger a page open, log output, or network request
- In the Unity console and the Guance 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
datakitUrlordatawayUrl; if you use the public network DataWay, also passclientToken.
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¶
- Keep
debug = trueenabled and run the application - Open a page or make a network request
- In the Unity console, confirm that logs related to SDK initialization and data synchronization appear
- Return to the Guance console and confirm that the corresponding RUM data appears in the application
If you need further troubleshooting, see Troubleshooting.
Next Steps¶
- For complete installation and initialization instructions, continue to Application Integration
- For descriptions of all initialization parameters, read SDK Initialization
- For detailed configuration of RUM, Log, and Trace, read RUM Configuration, Log Configuration, and Trace Configuration
- If your project combines native and Unity development, read Native and Unity Hybrid Development
- If you need to manually collect View, Action, Resource, Error, and LongTask, read RUM Manual Instrumentation