Class SDK
Main part of Pley SDK, handles the basic like Initialization, logging, etc...
Inheritance
Namespace: Pley
Assembly: Pley.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 PleyLogLevel LogLevel { get; set; }
Property Value
Type | Description |
---|---|
PleyLogLevel |
Methods
CrashGame(String)
Simple and short method to force a crash on Pley.
Declaration
public static PleyResult CrashGame(string errorMessage = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | errorMessage |
Returns
Type | Description |
---|---|
PleyResult |
ExitGame()
Exit method to close the game and return to the main page of Pley. This sadly won't trigger OnApplicationQuit as Unity currently do not support it! https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationQuit.html
Declaration
public static PleyResult ExitGame()
Returns
Type | Description |
---|---|
PleyResult | Whether it was able to quit the game. |
Finalize()
Declaration
protected void Finalize()
GetGameArguments()
Retrieves the game arguments from an invite link, notification or something else to provide some extra functionalities.
Declaration
public static GameArgument[] GetGameArguments()
Returns
Type | Description |
---|---|
GameArgument[] | Returns an array of the game arguments. |
GetGameArguments(out GameArgument[])
Retrieves the game arguments from an invite link, notification or something else to provide some extra functionalities.
Declaration
public static PleyResult GetGameArguments(out GameArgument[] gameArguments)
Parameters
Type | Name | Description |
---|---|---|
GameArgument[] | gameArguments |
Returns
Type | Description |
---|---|
PleyResult | Whether it succeeded or failed to retrieve the game arguments. |
GetStackTrace()
Declaration
public static string GetStackTrace()
Returns
Type | Description |
---|---|
System.String |
GetStackTrace(out String)
Declaration
public static PleyResult GetStackTrace(out string stackTrace)
Parameters
Type | Name | Description |
---|---|---|
System.String | stackTrace |
Returns
Type | Description |
---|---|
PleyResult |
InitializeAsync()
Initializes Pley SDK
Declaration
public static async Task<PleyResult> InitializeAsync()
Returns
Type | Description |
---|---|
Task<PleyResult> | Possible errors are the following: SdkAlreadyCreated, SdkAlreadyInitialized, InvalidArguments |
SetSupportDialogCustomFields((String, String)[])
Adds the passed fields to the support dialog. This can be used if you want users to be able to supply your support team with extra info.
Declaration
public static PleyResult SetSupportDialogCustomFields((string, string)[] fields)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<System.String, System.String>[] | fields | List of tuples. The first item defines the custom field label. The second item defines the custom field value |
Returns
Type | Description |
---|---|
PleyResult | Whether it was possible to set the support dialog custom fields |
Remarks
Calling this method will replace the previous fields with the new ones.
Examples
For example, if you have your own user IDs, you might want users to be able to communicate that when talking to your support.
var setSupportDialogCustomFieldsResult = SDK.SetSupportDialogCustomFields(new[] {
("Own user ID", "deadbeef-a114ebeef-b043beef"),
});
ShowSaveBookmarkPrompt()
Show a prompt which guides the user to bookmark the games URL
Declaration
public static PleyResult ShowSaveBookmarkPrompt()
Returns
Type | Description |
---|---|
PleyResult | Whether it was possible to show the save bookmark prompt |
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 |