Skip to main content
Version: SDK-5.11.4

Initialize

public BackendReturnObject Initialize(bool useAsyncPoll);
public BackendReturnObject Initialize(BackendCustomSetting settings);
public void InitializeAsync(bool useAsyncPoll, Action<BackendReturnObject> callback);
public void InitializeAsync(BackendCustomSetting settings, Action<BackendReturnObject> callback);

Parameters

ValueTypeDescription
useAsyncPollboolWhether the pooling function will be used to handle callbacks of asynchronous methods in the main thread
autoLocationToAsyncboolWhether to call the country information fetch asynchronously or after the initialization function and wait for the response until the country information is fetched.
settingsBackendCustomSettingThe parameter value object to be used when initializing the BACKND SDK
callbackAction<BackendReturnObject>Callback method of the asynchronous method to be called upon initialization success/failure

useAsyncPoll

If the useAsyncPoll parameter is declared as true, you must utilize an update method or coroutine from a specific Unity object and call the Backend.AsyncPoll method to properly call the asynchronous method's callback..

For more information, refer to the Callback Method Pooling documentation.

BackendCustomSetting

ValueTypeDescriptionDefault
packageNamestringGame package namestring.Empty
clientAppIDstringUnique game ID that identifies the gamestring.Empty
signatureKeystringKey required to encrypt data when exchanging game data with the serverstring.Empty
functionAuthKeystringKey for authentication when using BACKND Functionstring.Empty
isAllPlatformboolValue that determines whether an OS other than Android or iOS devices is allowed
If the value is 'false,' an error is returned when a user attempts to connect to the server from an OS other than Android or iOS.
true
sendLogReportboolValue that determines whether additional logs are stored in the server when a request is sent to the server.true
timeOutSecuintDetermines the time the system will wait for the server when the response does not arrive within the set time(seconds).
default: 100 seconds, min: 30 seconds, max: 100 seconds
100
useAsyncPollboolWhether the pooling function will be used to handle callbacks of asynchronous methods in the main threadfalse

If packageName is string.Empty, Application.identifier value is used for the SDK initialization.

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 BackendCustomSetting is passed as a parameter value of the initialization method, all values of The Backend Settings set in the Unity Inspector window are ignored, and the initialization of SDK is attempted with the values defined in BackendCustomSettings.
Values defined in The Backend Settings cannot be used interchangeably with values defined in BackendCustomSetting.

Example

Synchronous

using BackEnd;

void Start()
{
// First way(synchronous)
var bro = Backend.Initialize(true);
if(bro.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
}

Synchronous(SDK settings value declared directly)

using BackEnd;

void Start()
{
// Second way(synchronous)
// SDK settings value
BackendCustomSetting settings = new BackendCustomSetting();
settings.clientAppID = "Client app ID";
settings.signatureKey = "Signature key";
settings.functionAuthKey = "BACKND Function key";
settings.isAllPlatform = true;
settings.sendLogReport = true;
settings.timeOutSec = 100;
settings.useAsyncPoll = true;

var bro = Backend.Initialize(settings);
if(bro.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
}

Asynchronous

using BackEnd;

void Start()
{
// Third way(asynchronous)
Backend.InitializeAsync(true, callback => {
if(callback.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
});
}

Asynchronous(SDK settings value declared directly)

using BackEnd;

void Start()
{
// Fourth way(asynchronous)
// SDK settings value
BackendCustomSetting settings = new BackendCustomSetting();
settings.clientAppID = "Client app ID";
settings.signatureKey = "Signature key";
settings.functionAuthKey = "BACKND Function key";
settings.isAllPlatform = true;
settings.sendLogReport = true;
settings.timeOutSec = 100;
settings.useAsyncPoll = true;

Backend.InitializeAsync(settings, callback => {
if(callback.IsSuccess())
{
// Logic when initialization succeeds
}
else
{
// Logic when initialization fails
}
});
}

Return casess

Success cases

Server setting success
statusCode : 204
message : Success
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
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