To use Gamebase Unity SDK, initialization is required, and App ID and app version should be registered in the NHN Cloud Console.
Following settings are required for initialization.
Setting value | Supported Platform | Mandatory(M) / Optional(O) |
---|---|---|
appID | ALL | M |
appVersion | ALL | M |
storeCode | ALL | M |
displayLanguageCode | ALL | O |
enablePopup | ALL | O |
enableLaunchingStatusPopup | ALL | O |
enableBanPopup | ALL | O |
useWebViewLogin | Standalone | O |
Project ID registered in NHN Cloud.
Game > Gamebase > Console Guide > App > App
Client version registered in NHN Cloud.
Game > Gamebase > Console Guide > App > Client
Store information required to initialize In-App Purchase (IAP) of NHN Cloud.
Store | Code | Description |
---|---|---|
App Store | AS | only iOS |
Google Play | GG | only Android |
ONE Store | ONESTORE | only Android |
GALAXY Store | GALAXY | only Android |
Huawei AppGallery | HUAWEI | only Android |
My Card | MYCARD | only Android |
Windows | WIN | only Unity Standalone |
macOS | MAC | only Standalone |
Web | WEB | only Unity WebGL |
The display language on the Gamebase UI and SystemDialog can be changed into another language, which is not set on a device, as the user wants.
Game > Gamebase > Unity SDK User Guide > ETC > Additional Features > Display Language
When a game user cannot play games due to system maintenance or banned from use, reasons need to be displayed by pop-ups. This setting is related to applying default pop-ups provided by Gamebase SDK.
This setting is related to applying default pop-ups provided by Gamebase, when the LaunchingStatus is disabled to play games. For LaunchingStatus, refer to Status/Code below Launching.
This setting is related to applying default pop-ups provided by Gamebase, when the game user has been banned.
Set whether or not to log in to WebView on a (Standalone) platform.
[Caution]
Before releasing a game, make sure to delete SetDebugMode call from the source code or change the parameter to false before building.
Debug setting is also available in the Console, and this setting in the Console takes precedence over the other. To find out how to set up the Console, see the following guide.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void SetDebugMode(bool isDebugMode)
Example
public void SetDebugModeSample(bool isDebugMode)
{
Gamebase.SetDebugMode(isDebugMode);
}
Initialize SDK.
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static void Initialize(GamebaseRequest.GamebaseConfiguration configuration, GamebaseCallback.GamebaseDelegate<GamebaseResponse.Launching.LaunchingInfo> callback)
Example
public class SampleInitialization
{
public void Initialize()
{
/**
* Show gamebase debug message.
* set 'false' when build RELEASE.
*/
Gamebase.SetDebugMode(true);
/**
* Gamebase Configuration.
*/
var configuration = new GamebaseRequest.GamebaseConfiguration();
configuration.appID = "appID";
configuration.appVersion = "appVersion;"
configuration.displayLanguageCode = GamebaseDisplayLanguageCode.English;
#if UNITY_ANDROID
configuration.storeCode = GamebaseStoreCode.GOOGLE;
#elif UNITY_IOS
configuration.storeCode = GamebaseStoreCode.APPSTORE;
#elif UNITY_WEBGL
configuration.storeCode = GamebaseStoreCode.WEBGL;
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
configuration.storeCode = GamebaseStoreCode.MACOS;
#else
configuration.storeCode = GamebaseStoreCode.WINDOWS;
#endif
/**
* Gamebase Initialize.
*/
Gamebase.Initialize(configuration, (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.
}
}
}
});
}
}
When Gamebase Unity SDK is initialized by using Initialize API, LaunchingInfo object results will be delievered. This LaunchingInfo object contains settings of the NHN Cloud Gamebase Console and game status.
Launching information of Gamebase.
1.1 Status
Status information of game app version set in the Gamebase Unity SDK initialization.
For game status codes, refer to the table below.
Status | Code | Description |
---|---|---|
IN_SERVICE | 200 | Service is provided normally |
RECOMMEND_UPDATE | 201 | Update is recommended |
IN_SERVICE_BY_QA_WHITE_LIST | 202 | The service cannot be used during maintenance, but if the device is registered as a QA device, you can access and test the service regardless of maintenance status. |
IN_TEST | 203 | Test in progress |
IN_REVIEW | 204 | Review in progress |
IN_BETA | 205 | Beta server environment |
REQUIRE_UPDATE | 300 | Update is required |
BLOCKED_USER | 301 | The service has been accessed with a device (device key) registered as access blocked. |
TERMINATED_SERVICE | 302 | Service has been terminated |
INSPECTING_SERVICE | 303 | Service maintenance in progress |
INSPECTING_ALL_SERVICES | 304 | The whole service maintenance in progress |
INTERNAL_SERVER_ERROR | 500 | Internal server error |
Game > Gamebase > Console Guide > App > App
1.2 App
App information registered in the NHN Cloud Console.
Game > Gamebase > Console Guide > App > Client
1.3 Maintenance
Maintenance information registered in the NHN Cloud Console is as follows.
Game > Gamebase > Console Guide > Operation > Maintenance
If both the enablePopup
and enableLaunchingStatusPopup
values are true
, a maintenance popup will be automatically displayed if the game is in maintenance status.
If you click the DETAILS button here, the maintenance information is automatically displayed in a webview.
If you want to modify the displayed HTML file, download the HTML file from the following link, modify it as you need, and place it in the 'Assets > StreamingAssets > Gamebase' folder. Then the HTML file will be used to display maintenance information instead of the default HTML file included in the Gamebase SDK. HTML file download link
1.4 Notice
Following notices are registered in the Gamebase Console.
Game > Gamebase > Console Guide > Operation > Notice
1.5 user
Below is the user information who initialized Gamebase.
Appkey of NHN Cloud Products linked to Gamebase.
IAP store information registered in the NHN Cloud Console.
Game > Gamebase > Console Guide > Purchase
Refers to user-input information on NHN Cloud Launching Console.
Game > Gamebase > Console Guide > Management > Config
With the GetLaunchingInformations API, you can get the LaunchingInfo object even after initialization.
[Caution]
The GetLaunchingInformations API is not an asynchronous API that retrieves information from the server in real time. It returns cached information updated every 2 minutes, so it is not suitable for real-time checking of the current status. In that case, use GamebaseEventHandler, which triggers an event when the Launching Status Code is changed. Game > Gamebase > Unity SDK ser Guide > ETC > Additional Features > Gamebase Event Handler > Observer
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
static GamebaseResponse.Launching.LaunchingInfo GetLaunchingInformations()
Example
public GamebaseResponse.Launching.LaunchingInfo GetLaunchingInformations()
{
return Gamebase.Launching.GetLaunchingInformations();
}
By initializing GameClientVersion which is not registered on Gamebase console, error occurs like follows: LAUNCHING_UNREGISTERED_CLIENT(2004).
Under enablePopup(true), or enableLaunchingStatusPopup(true), popup shows for a forced update, and the user could be linked to the market.
If Gamebase popup is disabled, updates like market URL can be obtained from the GamsebaseError object.
VO
public class UpdateInfo {
// URL for store installation to download the latest version.
string installUrl;
// User can find a message in the language set on device.
// When the language is 'ko', the message shows like follows.
// 'This version is not supported. Please update to the latest version.'
string message;
}
API
Supported Platforms ■ UNITY_IOS ■ UNITY_ANDROID ■ UNITY_STANDALONE ■ UNITY_WEBGL ■ UNITY_EDITOR
GamebaseResponse.Launching.UpdateInfo GamebaseResponse.Launching.UpdateInfo.From(GamebaseError error);
Example
public class SampleInitialization
{
public void Initialize()
{
var configuration = new GamebaseRequest.GamebaseConfiguration();
configuration.appID = "appID";
configuration.appVersion = "appVersion;"
configuration.displayLanguageCode = GamebaseDisplayLanguageCode.English;
#if UNITY_ANDROID
configuration.storeCode = GamebaseStoreCode.GOOGLE;
#elif UNITY_IOS
configuration.storeCode = GamebaseStoreCode.APPSTORE;
#elif UNITY_WEBGL
configuration.storeCode = GamebaseStoreCode.WEBGL;
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
configuration.storeCode = GamebaseStoreCode.MACOS;
#else
configuration.storeCode = GamebaseStoreCode.WINDOWS;
#endif
Gamebase.Initialize(configuration, (launchingInfo, error) =>
{
if (Gamebase.IsSuccess(error) == true)
{
// Gamebase initialization succeeded.
}
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)
{
// Unregistered game client version.
// Open market url to update application.
string installUrl = updateInfo.installUrl; // Market URL.
string message updateInfo.message; // Message from launching server.
}
}
}
});
}
}
Error | Error Code | Description |
---|---|---|
NOT_INITIALIZED | 1 | Gamebase not initialized. |
NOT_LOGGED_IN | 2 | Login required. |
INVALID_PARAMETER | 3 | Invalid parameter. |
INVALID_JSON_FORMAT | 4 | JSON format error. |
USER_PERMISSION | 5 | No permissions. |
NOT_SUPPORTED | 10 | Function not supported. |