Initialization
Initialization
Before using Game Chat, it must be initialized. Add the project ID you checked in the dashboard. To initialize Game Chat, follow these steps:
Access the dashboard and check the project ID in the settings menu.
Use the following code to initialize instances.
Import the NBaseSDK module.
using NBaseSDK;
Create an NBaseSDK Chat instance.
NBaseSDK.Chat nc = NBaseSDK.Chat.GetInstance();
Initialize NChat. Enter the settings for projectId, region, and language.
nc.initialize([PROJECT_ID], [REGION], [LANGUAGE]);
ID
Type
Description
Required
PROJECT_ID
string
ID (Game Chat dashboard Project ID)
O
REGION
string
Region (use "kr" if not using a specific one)
O
LANGUAGE
string
Language code ("en", "ko", etc.)
O
Error handling
Basic error handling is to add the code inside the try... catch as follows:
try
{
// Write the code that may cause an error here.
...
}
catch (InvalidOperationException e)
{
// Write the handling for specific error types here.
Console.WriteLine("InvalidOperationException: {0}", e.Message);
}
catch(Exception e)
{
// Write the general error handling here.
Console.WriteLine("Error: {0}", e.Message);
}
Last updated