Class SDK
Main part of Trail SDK, handles the basic like Initialization, logging, etc...
Inheritance
Namespace: Trail
Assembly: Trail.dll
Syntax
public class SDK : object
Properties
IsGameFocused
Returns whether or not the game is currently in focus. Not being in any other tab or popup from Payments or invite link.
Declaration
public static bool IsGameFocused { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsInitialized
Checks whether or not SDK is initialized.
Declaration
public static bool IsInitialized { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LogEnabled
Enables or disables the logging by the SDK
Declaration
public static bool LogEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LogLevel
Set/Get the minimum log level for the SDK.
Declaration
public static LogLevel LogLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| LogLevel |
Methods
AddExtraGameLoadTask()
This will block any call to report game loaded until "FinishGameLoadTask" gets called.
Declaration
public static void AddExtraGameLoadTask()
CrashGame(String)
Simple and short method to force a crash on Trail.
Declaration
public static Result CrashGame(string errorMessage = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | errorMessage |
Returns
| Type | Description |
|---|---|
| Result |
ExitGame()
Exit method to close the game and return to the main page of Trail. This sadly won't trigger OnApplicationQuit as Unity currently do not support it! https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationQuit.html
Declaration
public static Result ExitGame()
Returns
| Type | Description |
|---|---|
| Result | Whether it was able to quit the game. |
Finalize()
Declaration
protected void Finalize()
FinishGameLoadTask()
This will call game loaded to Trail to remove the loading screen. This can further be blocked by Adding Extra tasks to be finished using SDK.AddExtraGameLoadTask()
Declaration
public static Result FinishGameLoadTask()
Returns
| Type | Description |
|---|---|
| Result |
GetStartupArgs()
Retrives the startup arguments from an invite link, notification or something else to provide some extra functionalities.
Declaration
public static SDK.StartupArg[] GetStartupArgs()
Returns
| Type | Description |
|---|---|
| SDK.StartupArg[] | Returns an array of the startup arguments. |
GetStartupArgs(out SDK.StartupArg[])
Retrives the startup arguments from an invite link, notification or something else to provide some extra functionalities.
Declaration
public static Result GetStartupArgs(out SDK.StartupArg[] startupArgs)
Parameters
| Type | Name | Description |
|---|---|---|
| SDK.StartupArg[] | startupArgs |
Returns
| Type | Description |
|---|---|
| Result | Whether it succeeded or failed to retrive the Startup Arguments. |
Init()
Initializes Trail SDK with the Default Dev Server Settings.
Declaration
public static Result Init()
Returns
| Type | Description |
|---|---|
| Result |
Init(String)
Initializes Trail SDK with custom dev host address. Example: 127.0.0.1:23000
Declaration
public static Result Init(string devHost)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | devHost | The address Trail SDK should connect to if running from Editor. |
Returns
| Type | Description |
|---|---|
| Result | Whether creating the SDK worked. The result of Initialization get's provided in Initialize Callback |
Events
OnFocusChanged
Callback for when the User changes focus from the game or comes back.
Declaration
public static event SDK.GameFocusedChangedCallback OnFocusChanged
Event Type
| Type | Description |
|---|---|
| SDK.GameFocusedChangedCallback |
OnInitialized
Callback when SDK is initialized, this also will call the subscribing method if SDK already is initialized.
Declaration
public static event SDK.InitializedCallback OnInitialized
Event Type
| Type | Description |
|---|---|
| SDK.InitializedCallback |
OnLogReceived
Callback whenever a log is being called from within SDK
Declaration
public static event SDK.LogReceivedCallback OnLogReceived
Event Type
| Type | Description |
|---|---|
| SDK.LogReceivedCallback |