• 1 Unity C# Integration
  • 2 Interfaces

Unity SDK Integration(Linux DS)


This document is to introduce the Linux DS platform Unity SDK, including the basic integration process, and how to use the interfaces.

1 Unity C# Integration

1.1 Download and Import Unity Plugin to Unity Project

CrashSight Linux DS SDK is currently not open for download, please contact "CrashSight Assistant" to get the SDK package.
Unzip the SDK package and copy the contents to the Assets directory of the project to complete the import.

1.2 Initialize CrashSight

Choose the first scene or the main scene, and call the following code in a script loaded as early as possible to initialize:

// Debug switch. In the debugging mode, more logs will be printed to locate issues.
#if DEBUG
        CrashSightAgent.ConfigDebugMode (true);
#endif
        CrashSightAgent.ConfigDebugMode (false);

// Set the target domain name to report to. Please fill in according to project requirements. (required)
        CrashSightAgent.ConfigCrashServerUrl (CrashSightUploadUrl);
// Set the target APP ID, APP KEY and version for reporting and initialize. You can find the APP ID and APP KEY from More->Product Settings->Product Info of the management console.
        CrashSightAgent.Init(CrashSightAppId, CrashSightAppKey, AppVersion);

Domain name for reporting

Domestic public cloud: pc.crashsight.qq.com

Overseas public cloud: pc.crashsight.wetest.net

2 Interfaces

2.1 Initialization

public static void Init(string appId, string appKey, string appVersion);

Note: Execute initialization. Initialize as early as possible to enable crash detection and reporting features.
The appid is CrashSight's unique identifier for the project, and can be viewed in Product Settings -> Product Information.
The appKey is CrashSight's reporting key for the project, and can be viewed in Product Settings -> Product Information.

ParameterTypeNote
appIdstringAPP ID of registered project
appKeystringAPP Key of registered project
appVersionstringapplication version

2.2 Reporting errors

public static void ReportException(System.Exception e, string message);

Note: Active C# exception reporting

ParameterTypeNote
eSystem.ExceptionCaught exception
messagestringException message
public static void ReportException(string name, string message, string stackTrace);

Note: Proactively report error messages. Can be called manually when an error is caught or needs to be reported, multi-threaded calls are supported. name, message and stackTrace cannot be null.

ParameterTypeNote
namestringException Name
messagestringException message
stackTracestringStack
public static void ReportException(int type, string exceptionName, string exceptionMsg, string exceptionStack, Dictionary<string, string> extInfo);

Note: Proactively report error messages. Can be called manually when an error is caught or needs to be reported, multi-threaded calls are supported. exceptionName, exceptionMsg and exceptionStack cannot be null.

ParameterTypeNote
typeintException Type, C#: 4, js: 5, lua: 6
exceptionNamestringException Name
exceptionMsgstringException Info
exceptionStackstringStack
extInfoDictionary<string, string>Other Info

View page:

extras: Crash Details->Download Attachments->extraMessage.txt

2.3 Setting user ID

public static void SetUserId(string userId);

Note: Setting user ID. The user id defaults to unknown.

ParameterTypeNote
userIdstringUser ID

2.4 Adding custom data

public static void AddSceneData(string key, string value);

Note: Set the Key-Value data customized by the user. It will be reported together with exception info when sending the crash. The total length supports up to 128k.

View page: Crash Details->Download Attachments->valueMapOthers.txt

ParameterTypeNote
keystringKey
valuestringValue

2.5 Setting the application version

public static void SetAppVersion(string appVersion);

Note: Set app version number

ParameterTypeNote
appVersionstringVersion Number

2.6 Reporting domain name settings

public static void ConfigCrashServerUrl(string crashServerUrl);

Note: Set domain name for reporting.

Note: Call it before the InitWithAppId interface.

Domain name for reporting

Domestic public cloud: pc.crashsight.qq.com

Overseas public cloud: pc.crashsight.wetest.net

A direct CrashSight domain name Integration is different from an indirect one using MSDK. Make sure you follow the above domain name to reconfigure. For other environment domain name, please consult the Integration contact.

ParameterTypeNote
crashServerUrlstringTarget domain name of reporting

2.7 Set upload log path

public static void SetLogPath(string logPath);

Note: Set an upload path for log after a crash. Read permission is required. The attachment is supported up to 8MB.

ParameterTypeNote
logPathstringLog absolute path

2.8 Enable Debug

public static void ConfigDebugMode(bool enable);

Note: Whether to enable debugging mode. Off by default. After enabling, some logs will be printed, but it can help locate issues during tests.

Note: Call it before the InitWithAppId interface.

ParameterTypeNote
enableboolEnabling switch for debugging

2.9 Set device id

public static void SetDeviceId(string deviceId);

Note: Set the device ID, by default uuid is used as the device ID

Note: Call it before the InitWithAppId interface.

ParameterTypeNote
deviceIdstringDevice ID

2.10 Customize logging

public static void PrintLog(CSLogSeverity level, string format, params object[] args);

Note: The custom log shouldn't exceed 30KB.

ParameterTypeNote
levelCSLogSeverityLog level
formatstringLog format
argsparams object[]variable arguments

Custom log view: issue details -> custom log (from interface)

2.11 Set path to all log files

public static void SetRecordFileDir(string record_dir);

Note: Set the path to all log files, including SDK logs and dump files, defaults to the directory of the current executable.

ParameterTypeNote
record_dirstringRecord file path
Last Updated: