Skip to main content
Version: 6.0.0

Initialize

public BackndReturnObject Initialize();
public BackndReturnObject Initialize(BackndCustomSettings settings);

Parameters

ValueTypeDescription
settingsBackndCustomSettingThe parameter value object to be used when initializing the BACKND SDK
callbackAction<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

ValueTypeDescriptionDefault
packageNamestringGame package namestring.Empty
cappSignatureKeystringKey required to encrypt data when exchanging game data with the server
functionAuthKeystringKey for authentication when using BACKND Functionstring.Empty
isSendLogReportboolA 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
isDebugModeboolWhen you call a function, the return value of that function appears in Debug.Log.true
isLoadLocationboolWhen BACKND initializes, it fetches country information from the server. Upon login, country information is generated for the user.true
isLoadLocationAsyncboolWhether to fetch the country information after initialization and return, or return after initialization and fetch the country information asynchronously.true
networkTypeNetworkTypeUNITY_WEB_REQUEST(Unity Request Library)(Recommend) / HTTP_CLIENT(C#)UNITY_WEB_REQUEST
isDispatcherActiveboolOnly 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

Server setting success
statusCode : 204

In addition, 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

When the Client App ID or Signature Key is invalid
statusCode : 404
errorCode : NotFoundException