Skip to main content

Installation and environment configuration

Download SDK

Enable chat

The following details the method to enable chat in the console:

1. Connect to the console.

2. Click Channel, Reports and Restrictions, or Settings under Chat.

3. Click the Enable Chat button.

Create chat channels

You can create a chat channel via Chat -> Channel in the console.

1. Click Channel.

2. Create channel groups and channels

  1. Click the + button next to Channel Groups.
  1. Enter the channel group name and the maximum number of users per channel. Then, select a FALLBACK channel and click Next.
  1. Enter the name of the first channel and click the Create button.

Check chat authentication key

You can check the chat authentication key in the console via Chat -> Settings.

// Enter when resetting SDK. "xxxx-xxxx-xxxxxx-xxxxxxx" - Chat authentication key
ChatClient = new ChatClient(this, "xxxx-xxxx-xxxxxx-xxxxxxx", "default");

Installation and environment configuration

The following details the method to download the Chat SDK and configure a project in Unity:

  1. In Unity, click Assets > Import Package > Custom Package... menus in order.
  2. Load the 'BackendChat-x.x.x.unitypackage' file you have downloaded.
  3. Select all the files in the package and click the Import button.
  4. Save the project.

Using BACKND methods other than login

The Base SDK (Backend.dll) included in the Chat SDK only includes sign-up and login functions.

  • If you are already using the Base SDK and importing an SDK, exclude Backend.dll.
    If you are using an SDK version earlier than 5.11.1, please update it to 5.11.1 or a later version.
  • If you wish to use the Base's functions aside from the login function, import the BackendChat SDK and Base SDK ver. 5.11.1 or later to overwrite Backend.dll.

Log in to BACKND Base

Description

To use the chat's user management function, you must implement sign-up and login steps according to the process below:

1. Enter the Client App ID and Signature Key of the BACKND Console project

Go to BACKND Console's Project Settings > Authentication Information, copy the Client App ID and Signature Key, and click The Backend > Edit Settings on the upper section of Unity.
Paste the two copied values.

Example

using BackEnd;
using UnityEngine;

public class LoginManager : MonoBehaviour
{
public InputField Username = null;

public InputField Password = null;

void Start()
{
Backend.Initialize(true);
}

void Login()
{
var returnObject = Backend.BMember.CustomLogin(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomLogin Fail");

Debug.Log("CustomSignUp");

returnObject = Backend.BMember.CustomSignUp(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomSignUp Fail");
return;
}

returnObject = Backend.BMember.CustomLogin(Username.text, Password.text);
if (false == returnObject.IsSuccess())
{
Debug.Log("CustomLogin Fail");
return;
}

// Nickname update - You cannot connect to the chat if you do not have a nickname.
Backend.BMember.UpdateNickname(Username.text);
}
}
}

Chat client

Description

To receive changes and messages, you must implement certain callback methods in the application.
In C#, they are defined with the IChatClientListener interface.

Example

public class UIChatManager : MonoBehaviour, BackEndChat.IChatClientListener
{
private BackEndChat.ChatClient ChatClient = null;

void Start()
{
// xxxx-xxxx-xxxxxx-xxxxxxx - Chat authentication key
ChatClient = new ChatClient(this, "xxxx-xxxx-xxxxxx-xxxxxxx", "default");
}

void Update()
{
ChatClient?.Update();
}

public void OnJoinChannel(ChannelInfo channelInfo) { }

public void OnLeaveChannel(ChannelInfo channelInfo) { }

public void OnJoinChannelPlayer(string channelGroup, string channelName, UInt64 channelNumber, string gamerName, string avatar) { }

public void OnLeaveChannelPlayer(string channelGroup, string channelName, UInt64 channelNumber, string gamerName, string avatar) { }

public void OnChatMessage(MessageInfo messageInfo) { }

public void OnWhisperMessage(WhisperMessageInfo messageInfo) { }

public void OnHideMessage(MessageInfo messageInfo) { }

public void OnDeleteMessage(MessageInfo messageInfo) { }

public void OnSuccess(SUCCESS_MESSAGE success, object param)
{
switch(success)
{
default:
break;
}
}

public void OnError(ERROR_MESSAGE error, object param)
{
switch(error)
{
default:
break;
}
}

private void OnDestroy()
{
ChatClient?.Dispose();
}

private void OnApplicationQuit()
{
ChatClient?.Dispose();
}
}