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:

  1. Access the dashboard and check the project ID in the settings menu.

  2. Use the following code to initialize instances.

  • Imports NBaseSDK module.

using NBaseSDK;
  • Creates an instance of NBaseSDK Chat.

NBaseSDK.Chat nc = NBaseSDK.Chat.GetInstance();
  • Initializes Game Chat with the project ID, region, and language code.

nc.initialize([PROJECT_ID], [REGION], [LANGUAGE]);

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 handling of specific error types here.
    Console.WriteLine("InvalidOperationException: {0}", e.Message);
}
catch(Exception e)
{
    // Write handling of general errors here.
    Console.WriteLine("Error: {0}", e.Message);
}

Last updated