Installation and environment configuration
Download SDK
- BackndChat-1.2.1.unitypackage [2024-07-09]
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 channel
You can create a chat channel via Chat -> Channel in the console.
1. Click Channel.
2. Create channel groups and channels
- Click the + button next to Channel Groups.
- Enter the channel group name and the maximum number of users per channel. Then, select a FALLBACK channel and click Next.
- Enter the name of the first channel and click the Create button.
Installation and environment configuration
The following details the method to download the Chat SDK and configure a project in Unity:
- In Unity, click Assets > Import Package > Custom Package... menus in order.
- Load the 'BackendChat-x.x.x.unitypackage' file you have downloaded.
- Select all the files in the package and click the Import button.
- Save the project.
Setting Unity authentication values
To use chat in Unity, you must set the common server key and the chat server key.
- In BACKND Console, go to Chat > Settings tab and copy the common server key.
- Click The Backend > Edit Settings on the upper side of Unity. Then, enter the Client App ID and Signature Key in the created inspector.
- In BACKND Console, go to Chat > Settings tab and copy the chat server key (Chat UUID).
- Click The Backend > Edit Chat Settings on the upper side of Unity. Then, enter the Chat UUID in the created inspector.
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:
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");
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.
Features
One of our Chat SDK's features is the automatic reconnection process. When a user's network is changed or leased, the reconnection process is executed automatically. Because of automatic reconnection process, you do not have to manage the process separately as long as you proceed with the disposal when terminating the client after assigning ChatClient.
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, "default");
// // If the inspector is not configured, you can register the Chat UUID using the parameter value below.
// 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();
}
}