To quickly integrate, start with an empty Unity project, import the Five Minute Chat package, and drag the demo prefab called 'tabbed chat V2' into your hierarchy. This immediately provides a functional chat connected to Five Minute Chat services. For a more custom setup, add the ChatConnectionBehavior, ChatInputFieldBehavior, and ChatLogBehavior scripts to appropriate GameObjects in your scene and link them.
When you first add the demo prefab, it comes with globally available 'Demo01' credentials. To get your own private chat, you should press the 'Request application ID' button in the ChatConnectionBehavior (or `SupportConnectionBehavior`) component's inspector view.

This will automatically generate and fill in your unique Application ID and Secret. Note that a new application ID cannot be requested within a 24-hour period, once one has been successfully received.

Further, the received Application ID and Secret are saved to local storage in Unity (EditorPrefs), so you can restore them later if needed.
No, you do not have to change your Application ID and Secret. You can continue using the same credentials in Unity. The web dashboard is simply a management interface for your existing application and does not require new credentials.

When onboarding to the web dashboard, you will be offered the option to "claim" your existing Unity application by entering your current Application ID and Secret. This allows you to manage your application and its settings without changing anything in your Unity project.
For basic chat functionality, you need three main scripts: `ChatConnectionBehavior`, `ChatInputFieldBehavior`, and `ChatLogBehavior`. The `ChatConnectionBehavior` manages the connection to the Five Minute Chat services, `ChatInputFieldBehavior` handles user input, and `ChatLogBehavior` displays incoming messages.
For support ticket functionality, you need SupportConnectionBehavior and SupportLogBehavior. Similar to chat, `SupportConnectionBehavior` manages the connection, while `SupportLogBehavior` is used to display the log and manage sending messages within support tickets. A `SupportRequests` prefab is also provided for quick setup.
The Unity asset has two dependencies, one of which is a soft dependency and the other is fully optional: TextMeshPro and SignalR Best Http 2. TextMeshPro is only required if you use one of the asset's prefabs, and SignalR Best Http 2 is optional, used for a specific SignalR transport option.
TextMeshPro is only required if you are using one of the prefabs available in the asset. It is not a functional dependency for the core Five Minute Chat functionality itself, so you can remove it if you are not using TMP-dependent prefabs.
No, SignalR Best Http 2 is entirely optional and is provided for convenience. It is used with one of the SignalR transport options and can offer benefits like AOT platform support when building with IL2CPP.
If you lose your Application ID and Secret, they are saved to local storage in Unity (EditorPrefs). You can restore them by pressing the 'Restore last application ID' button in the `ChatConnectionBehavior` (or `SupportConnectionBehavior`) component.

Accidental deletion of a component or failure to save a scene can lead to such a loss of credentials, hence this restore feature bridges the gap of human or technical error.
The Application ID uniquely identifies your game or app to the Five Minute Chat Services, ensuring chat channels and private messages are routed correctly. You can think of this as a username for your specific game. The Application Secret acts as a password for your application to authenticate itself with the services. It should be kept confidential and safeguarded.
A user is uniquely identified by the Unique User ID. By default, if this field is left empty, the asset then uses Unity's `SystemInfo.deviceUniqueIdentifier` as a fallback. For scenarios where users might log in from multiple devices, it's recommended to use an email address, UGS, advertisement or similar ID instead, as Five Minute Chat transparently supports this scenario.

Whatever value you chose to use as a Unique User Id, it is important to make sure it is indeed unique per user!
In the `ChatConnectionBehavior` component, you can use the 'Don't destroy on load' checkbox. If checked, the connection will persist across scene loads. If unchecked, the connection will be lost when the component is destroyed, requiring re-establishment. Managing the connection lifecycle can also be done programmatically without destroying the component, so it is generally advised to keep this checkbox checked.
The available preferred transport options are: TCP (using raw TCP socket connections) and SignalR Core (default). SignalR Core uses standard SignalR (Core) libraries from Microsoft and is the only option available when building for WebGL. An additional SignalR Best Http 2 option is available if you have that asset in your project, potentially offering benefits for AOT platforms with IL2CPP.
The 'Auto-connect' checkbox in the `ChatConnectionBehavior` component determines if the chat connection initializes immediately when the component starts. If unchecked, you can control the connection programmatically using the `Connect()` method.
You can define the minimum log level that the asset will output using the 'Log level' setting in the `ChatConnectionBehavior` component. This helps manage the verbosity of logs, which can be useful for debugging or reducing noise once configured.
You can send a chat message programmatically using the `SendChatMessage(string message, string channelName)` method of the ChatConnectionBehavior script. The message content cannot be an empty or null string (this will throw an exception). This script also supports in-message commands like `/join`, `/leave`, and `/nick`.
A user can change their username programmatically by calling the `SetUsername(string username)` method. Alternatively, they can use the chat command /nick if you've retained the behavior of the demo's input behavior. If a username is not set, messages will be sent as 'ANONYMOUS-VWXYZ'. Full UTF-8 character sets should be supported for nicknames.
To join a channel programmatically, use the `JoinChannel(string channelName)` method. To leave, use `LeaveChannel(string channelName)`. Chat commands /join and /leave are also supported.
You can create a new chat channel using the `CreateChannel(string channelName)` method. If `channelName` is left null or empty, a random channel name will be generated. The response from the server contains success status and the name of the channel.
You can retrieve information about a channel by calling the `GetChannelInfo(string channelName)` method. The server's response will contain channel users and the name of the channel.
To send a private message (whisper), use the `Whisper(string recipientDisplayId, string message)` method. The `recipientDisplayId` identifies the target user. Whispers are messages that target a specific user, as opposed to chat messages which target a channel.
You can retrieve information about a user by calling the `Whois(string recipientDisplayId)` method, which returns the user's Name and Display ID.
The 'Tabbed Chat V2' is a demo prefab included in the asset, demonstrating a simple chat dialog that dynamically populates with channels as a user joins or leaves them. It's provided as a starting point and is intended for modification to suit specific game requirements, as every game has its own set of requirements on styling, behavior, and so on.
Yes, when targeting WebGL, you'll need to do a few extra steps. The asset comes with a default WebGL template in the `Assets/WebGLTemplates` folder, which you should select in Project Settings > Player > WebGL Tab > Resolution and Presentation > WebGL Template. This template includes the SignalR client library and custom JavaScript (Scripts/FiveMinuteChat.jslib) and C# (Scripts/Helpers/WebGLCallbackListener.cs) scripts for communication with the browser.
Currently, the demo chat log displays a limited number of messages. In the next release of the client asset, you'll be able to request chat history in batches and specify the range to fetch. For more detailed customization of how the chat log is displayed (scrolling, custom layouts), you should look into the source code of the ChatLogBehavior script.
The demo prefab will automatically refocus on the input field when it loses focus. This is a convenience feature in the demo code. To disable this, you can look into the `ChatInputFieldBehavior` script and comment out the lines that say `_inputField.ActivateInputField();` and `_inputField.Select();`.
This type of conflict usually occurs when another library in your project defines a type that also exists in Five Minute Chat, such as the standard .Net `Timer` type. If it's a type defined by Five Minute Chat, you can often resolve this by prefixing it with its full namespace. If the issue persists, importing the asset into a clean project and adding other assets one by one can help identify the conflicting library.

Sometimes multiple assets import the same dependencies, and this is commonly resolved by simply removing one of them. In some cases, it may be more complex when different versions of dependencies exist across different assets, so a generic solution is difficult to outline.

Lastly, if you identify the conflicting library, please report it to us in our Discord server so we can look into a more permanent fix.
If you wish to simply not display previous chat history upon connection, you should avoid sending the `ClientChannelHistoryRequest` or `ClientChannelHistoryPagedRequest` (and their whisper equivalents) when the connection is established. In the demo asset, this logic is typically found in the ChatMessageHandler.cs method `OnServerWelcome`.
When a new message is sent, the client receives a `ServerChatMessage` event. When chat history is retrieved, the client receives either a `ServerChannelHistoryResponse` or `ServerChannelHistoryPagedResponse`. You can handle these events differently by defining your own custom message handler instead of using the default demo one. This allows you to process and display new messages and historical messages distinctively.