Lobby Chat Director
Simple chat made simple
Last updated
Simple chat made simple
Last updated
Support us as a and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our ... become a sponsor today!
The Lobby Chat Director must be attached to a Lobby Manager. The director simply exposes lobby chat features to the Steam Inspector.
Occurs when a chat message is received on this lobby, The handler for this event would take a form similar to.
Sends the related data to the lobby chat.
The total length of the message regardless of datatype must be less than 4kb in size. When sending a jsonobject Heathen will use Unity's JsonUtility to convert the object to a JSON string and then use UTF8 encoding to convert that to a byte[] before sending.
The above demonstrates a valid handler; you would want to display that message to your users. You can do this with whatever UI system you use that part is up to you.
You may have noticed that the Lobby Chat Director can send an object over the chat channel. This object must be serializable by UnityEngine.JsonUtility. What happens is that Heathen's system will use the JsonUtility and the UTF8 encoding tool in .NET to convert your object to a byte[] for sending.
You can create your own serializable object type such as a class or struct and send that via the Send method. When you receive a message you can fetch that type using the FromJson member.
You can get as clever or remain as simple as you like with this system. For example, you could use class inheritance to determine the data type of a message or you could simply assume that any message that starts with the { character is a JSON string and so should be read via the FromJson.
You can see more examples and sample code in the Samples section of the asset.
Uses the object
The most common use case for Lobby Chat is as a simple text-based chat system. In this model, your users would typically if not always be sending string data. You would simply listen on the such as
See the object article for more information on what you can find in the message parameter.