Quick Start¶
This document provides the shortest integration path for the Unity RUM SDK to help you complete verifiable data reporting with minimal steps.
The application supports Agent automatic access and manual access. The following steps describe the minimal configuration for manual access.
Prerequisites¶
Before you begin, complete the following preparations:
- Create a Unity Android app and a Unity iOS app in Real User Monitoring (RUM), and obtain the corresponding
App ID - Confirm the reporting endpoint and authentication method:
- Local environment deployment: Prepare
datakitUrl - Public DataWay: Prepare
datawayUrlandclientToken - Confirm that the project has imported
ft-sdk-unity.unitypackage - Confirm that the project has installed
"com.unity.nuget.newtonsoft-json"
Integration Steps¶
- Drag
FTSDK.prefabto the first scene - Call
FTUnityBridge.Install(...)at application startup - Initialize
RUMConfigand pass in the correspondingApp IDfor Android and iOS - Initialize
LogConfigandTraceConfigas needed - Run the application and trigger a page open, log print, or network request
- Verify in the Unity console and the Guance platform that data has been successfully reported
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,
});
Choose either
datakitUrlordatawayUrl; if using public 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 Listening¶
If you want to convert Unity exceptions to RUM Errors, 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
- Confirm that logs related to SDK initialization and data synchronization appear in the Unity console
- 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, see App Access
- For descriptions of all initialization parameters, see SDK Initialization
- For detailed RUM, Log, and Trace configurations, see RUM Configuration, Log Configuration, and Trace Configuration
- If your project uses native and Unity hybrid development, see Native and Unity Hybrid Development
- If you need to manually collect View, Action, Resource, Error, and LongTask, see RUM Custom Tracking