Gamebase SDK for Unity 2.75.1 Toast Gamebase Platform

Loading...
Searching...
No Matches

## ◆ Initialize() [1/2]

static void Initialize | ( | GamebaseCallback::GamebaseDelegate< GamebaseResponse::Launching::LaunchingInfo > | callback | ) |
| static

This function initialize the Gamebase SDK with inspector settings.

If this function is not called, the Gamebase SDK function will not work.

Since
  Added 1.4.0.

Parameters

  callback | The callback provided will return a LaunchingInfo object that contains the infomations of Gamebase.

Example Usage :

public void InitializeWithInspectorSettingsSample()
{
Gamebase.Initialize((launchingInfo, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
Debug.Log("Initialization succeeded.");
//Following notices are registered in the Gamebase Console
var notice = launchingInfo.launching.notice;
if (notice != null)
{
if (string.IsNullOrEmpty(notice.message) == false)
{
Debug.Log(string.Format("title:{0}", notice.title));
Debug.Log(string.Format("message:{0}", notice.message));
Debug.Log(string.Format("url:{0}", notice.url));
}
}
// Status information of game app version set in the Gamebase Unity SDK initialization.
var status = launchingInfo.launching.status;
// Game status code (e.g. Under maintenance, Update is required, Service has been terminated)
// refer to GamebaseLaunchingStatus
if (status.code == GamebaseLaunchingStatus.IN_SERVICE)
{
// Service is now normally provided.
}
else
{
switch (status.code)
{
case GamebaseLaunchingStatus.RECOMMEND_UPDATE:
{
// Update is recommended.
break;
}
// ...
case GamebaseLaunchingStatus.INTERNAL_SERVER_ERROR:
{
// Error in internal server.
break;
}
}
}
}
else
{
// Check the error code and handle the error appropriately.
Debug.Log(string.Format("Initialization failed. error is {0}", error));
if (error.code == GamebaseErrorCode.LAUNCHING_UNREGISTERED_CLIENT)
{
GamebaseResponse.Launching.UpdateInfo updateInfo = GamebaseResponse.Launching.UpdateInfo.From(error);
if (updateInfo != null)
{
// Update is require.
}
}
}
});
}
Toast.Gamebase.Gamebase.Initialize
static void Initialize(GamebaseCallback.GamebaseDelegate< GamebaseResponse.Launching.LaunchingInfo > callback)
This function initialize the Gamebase SDK with inspector settings.
Definition: Gamebase.cs:136
Toast.Gamebase.Gamebase.IsSuccess
static bool IsSuccess(GamebaseError error)
Return true if the GamebaseException object is null or the error code is zero.
Definition: Gamebase.cs:57
Toast.Gamebase.Gamebase
The Gamebase class is core of Gamebase service.
Definition: Gamebase.cs:11