Initialize
public BackndReturnObject Initialize();
public BackndReturnObject Initialize(BackndCustomSettings settings);
public void InitializeAsync(Backend.BackendCallback callback);
public void InitializeAsync(BackendCustomSetting settings, Backend.BackendCallback callback);
Parameters
Value | Type | Description |
---|---|---|
settings | BackndCustomSetting | The parameter value object to be used when initializing the BACKND SDK |
callback | Action<BackndReturnObject> | Callback method of the asynchronous method to be called upon initialization success/failure |
For more information, refer to the Callback Method Pooling documentation.
BackndCustomSettings
Value | Type | Description | Default |
---|---|---|---|
packageName | string | Game package name | string.Empty |
c | appSignatureKey | string | Key required to encrypt data when exchanging game data with the server |
functionAuthKey | string | Key for authentication when using BACKND Function | string.Empty |
isSendLogReport | bool | A value that determines whether additional logs will be stored on the server when a request is sent to the server. If this value is checked, an additional log separate from the existing one is left when sending a request. The new log is used to track errors later or to improve BACKND. Checking this option will not cause much difference in response speed, but the response speed may become slightly slower if checked. | true |
isDebugMode | bool | When you call a function, the return value of that function appears in Debug.Log. | true |
isLoadLocation | bool | When BACKND initializes, it fetches country information from the server. Upon login, country information is generated for the user. | true |
isLoadLocationAsync | bool | Whether to fetch the country information after initialization and return, or return after initialization and fetch the country information asynchronously. | true |
networkType | NetworkType | UNITY_WEB_REQUEST(Unity Request Library)(Recommend) / HTTP_CLIENT(C#) | UNITY_WEB_REQUEST |
isDispatcherActive | bool | Only occurs when the Network Type is HTTP_CLIENT. Whether the callback should be called on the main thread after the asynchronous function call. If true, it will be executed on the main thread. If false, execute on an external thread. | true |
Description
To use BACKND SDK, you must undergo SDK initialization.
The initialization process only needs to be done once while the game is running.
If BackndCustomSetting is passed as a parameter value of the initialization method, all values of The Backnd Settings set in the Unity Inspector window are ignored, and the initialization of SDK is attempted with the values defined in BackndCustomSettings.
Values defined in The Backnd Settings cannot be used interchangeably with values defined in BackndCustomSetting.
Example
Synchronous
using BACKND;
void Start()
{
// First way(synchronous)
var bro = Backnd.Initialize();
if(bro.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
}
Synchronous(SDK settings value declared directly)
using BACKND;
void Start()
{
// Second way(synchronous)
// SDK settings value
BackndCustomSettings backndCustomSettings = new BackndCustomSettings()
{
clientAppId = "3ad24d10-d543-11ee-a846-492412327fee1234",
appSignatureKey = "3ad27420-d543-11ee-a846-492313c27fee1234",
functionSignatureKey = "",
isDebugMode = true,
isSendLogReport = true,
networkType = NetworkType.UNITY_WEB_REQUEST,
isDispatcherActive = true
};
var bro = Backnd.Initialize(backndCustomSettings);
if(bro.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
}
Asynchronous
using BACKND;
void Start()
{
// Third way(asynchronous)
Backnd.Initialize( callback => {
if(callback.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
});
}
Asynchronous(SDK settings value declared directly)
using BACKND;
void Start()
{
// Fourth way(asynchronous)
// SDK settings value
BackndCustomSettings backndCustomSettings = new BackndCustomSettings()
{
clientAppId = "3ad24d10-d543-11ee-a846-492412327fee1234",
appSignatureKey = "3ad27420-d543-11ee-a846-492313c27fee1234",
functionSignatureKey = "",
isDebugMode = true,
isSendLogReport = true,
networkType = NetworkType.UNITY_WEB_REQUEST,
isDispatcherActive = true
};
Backnd.Initialize(backndCustomSettings, callback => {
if(callback.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
});
}
Return casess
Success cases
statusCode : 204
message : Success
In addition, Server setting success is printed on the Unity debug console window.
Error cases
When the Client App ID or Signature Key is null or string.Empty
statusCode : 400
errorCode : InitializeFail
message : Please Edit the Baceknd Settings
When the Client App ID or Signature Key is invalid
statusCode : 404
errorCode : NotFoundException
message : game not found, game cannot be found