In-Game Chat in Unity: Features, Architecture, and SDKs

TL;DR
- Unity and Unreal networking can send chat messages, but a full chat system also needs history, permissions, moderation, and more. Building and running all of that yourself is a lot of work.
- Text needs a service that runs outside the game and stores every message. Voice and video use WebRTC with servers that forward the audio and video.
- Unity's Vivox handles voice well, and its text history lasts 7 days (up to 30 with extended retention). That is short for persistent communities like clans and guilds, which Stream's Chat SDK is built for.
- Stream's Unity Chat and Video SDKs add persistent chat, voice rooms, video, and moderation for the same players and groups.
Game engines are built for one thing: running the game. Rendering a world, simulating it, and keeping every player in a match seeing the same thing at the same time.
But gaming is so much more than that. Now, the social aspects of gaming, such as chat, voice, and even video, are integral to the gaming experience. Unity and Unreal cover part of this. Unity has Vivox for voice and text, and Unreal supports voice through Epic Online Services. Neither includes a fully managed video calling solution, and neither covers the range Stream Video supports: voice chat, audio rooms with speaker and listener roles, video calls, livestreaming, and recording.
Conversation is a different kind of data from game state. It has to survive the end of the match, be readable by a player who wasn't online, and be safe for whoever receives it.
Here, we cover why chat belongs inside the game, what a game needs for text, voice, and video, what Unity provides natively, and what our SDKs add on top.
Why Build Chat Into the Game?
The case for building chat into the game, instead of pointing players to Discord, hasn't changed. Players who talk to each other keep playing, and a community that forms inside your game is one you can see, moderate, and design around. If players have to leave the game to find a group, the community forms somewhere else, and that platform owns it.
It is no surprise that games such as Clash of Clans, Final Fantasy XIV, and World of Warcraft give their communities a place to talk inside the game. Communities, friendships, and guilds give players more reasons to keep coming back, so these games invest in social features that keep those conversations in the game.
What In-Game Communication Needs Today
Text, voice, and video have completely different jobs for a gamer:
- Text is where the community lives between matches. A player wants their group channel to still be there when they log back in, a DM to an offline friend to get seen, and a quick line to the team mid-match without leaving the controls for long.
- Voice is for the match and the party. A player wants to talk to teammates with both hands on the controls, callouts that arrive straight away, and to hear only who they chose, whether that's the team, the party, or the players nearby.
- Video is for hanging out, not playing. A player wants it in a lobby or a group meeting, camera on and off in one press, no drop in frame rate, and never with the whole server.
So a game today needs text and voice from launch, on every platform it ships on, tied to the same player, party, and group in both. A console player and a PC player in one group see the same channel and hear the same room. Video is worth adding, where the game has somewhere to hang out, like a lobby.
Here's what each one takes to build:
| Text | Voice | Video | |
|---|---|---|---|
| Transport | A WebSocket per player | WebRTC | WebRTC |
| What's stored | Every message | Nothing, unless you record | Nothing, unless you record |
| Client work | Almost none | Clean up and encode the mic (noise suppression, echo cancellation), decode each speaker | Process and encode the camera (such as background blur for privacy), decode each visible participant |
| Moderation | Filter before delivery, review after | Mute, block, report; transcribe to review | The same as voice, plus frames |
Text needs a service that runs outside the game, because sending messages is only a small part of a chat system. You could build on your engine's networking, but you would also have to build message history, offline delivery, permissions, moderation, search, and push notifications, on both the client and the server. Then you have to keep all of it running.
Voice and video are different because WebRTC already does the client side, from capturing the mic and canceling echo to getting through NAT and covering packet loss. What it doesn't do is the server. Past two or three people, sending directly means each player uploads their audio to every other player, so a server near them takes one copy from each and forwards it to the rest of the room.
Core Features Every In-Game Chat Needs
Whatever you build it on, a chat system has to do a lot more than send and receive. For text, players expect:
- Presence and status, so a friends list or guild roster shows who's online, when someone was last on, and a status the game sets (like in a match), plus typing indicators, read receipts, and unread counts.
- Channel types with their own rules. A global channel is read by everyone and posted to by a few, a guild channel is members only, a match channel lives for one match, and a DM is two people or a small group. Who can post, invite, pin, upload, or delete is set per type.
- Everything in a message. History loads as the player scrolls up, with search, reactions, threads, mentions that notify the person, quoting, editing and deleting, pinned messages for announcements, and attachments with size limits and image scanning.
- Ways to send without typing: a set of preset lines (gg) or a wheel for controller players and mid-match, plus translation so players in different countries can read each other.
- Push notifications for a DM or a mention when the player isn't in the game.
- Mute, block, and report from the player's side, and slow mode and moderator roles from yours.
For voice, they expect push-to-talk or open mic, per-player volume and mute, a speaking indicator next to each name, and a team channel and a party channel at the same time. A party leader expects to mute or remove someone and to pull a friend in from the friends list.
Then there's what happens when a lot of people use it at once. Launch day, a tournament final, or a live event means thousands of players connecting in the same second, and the whole thing has to stay up and fast through it. Scale is the hardest one to test before launch. We ran 5 million concurrent connections in a single channel, with around 4,000 users joining per second, and average message send latency stayed under 40 milliseconds throughout.
A launch weekend or a tournament final should sit well inside that.
Native Engine Options in Unity and Unreal
Unity's and Unreal's networking exists so everyone in a match sees the same thing: where each player is, who has how much health, and who just got rekd. It runs while the match runs and only between the players in it. You could build chat on top of it, but it would only reach players in the match while the match is on, and it could cause latency problems in the game.
Unity: Netcode for Match Chat, Vivox for Voice and Text
In Unity, that's Netcode for GameObjects. A chat message goes to the host as an RPC, and the host sends it to everyone else in the session. Unity's Multiplayer Services sessions, which wrap Lobby, Matchmaker, and Relay, get players into the match, and the lobby holds data about it. It is not for messages.
Vivox is Unity's closest thing to built-in chat, and it's part of Unity Gaming Services. It does voice well, with 2D team channels, 3D positional voice, per-player mute and volume, and speech-to-text; in Unity 6, the Vivox Building Block drops voice, text, device selection, and a roster into a scene. It's free up to 5,000 peak concurrent users.
Its text works the same way as its voice, through channels a player is logged into. A message reaches whoever's in the channel at the time, with an optional short history for someone who joins late. Nothing is kept for a player who reads the channel the next day; there's no search and no push notifications.
Unreal: Replication for Match Chat, EOS for Voice
Unreal's replication carries chat the same way Netcode does: a server RPC up and a multicast down. Voice goes through the engine's Voice Chat Interface, one API in front of whichever provider you use, and the usual provider is EOS voice. With the Lobbies method, joining an EOS lobby also joins its voice room. With the Trusted Server method, your backend asks EOS for a room token and hands it to the client, which is how you get voice for a group that isn't a lobby, like a team inside a match or a party that outlives it.
For text, EOS has an RTC data channel inside a voice room that sends small data messages to everyone in the room, with no message store behind it. For persistent chat, there's our Unreal Chat SDK.
Build Chat in Unity Yourself, or Use an SDK?
Building it yourself means creating a separate chat service and running it in every region your players are in, with someone on call after launch. This also isn't Unity work, so your Unity devs either need to work across languages, or you need a dedicated engineer for the project.
| What the game needs | What to use |
|---|---|
| Text between the players in a match, nothing kept afterward | An RPC over Netcode for GameObjects |
| Voice in matches and parties, and you're already on Unity Gaming Services | Vivox |
| Anything that lives outside the match: guild chat, DMs, history, push, moderation | A chat service, built and run by you or ours through the Chat SDK |
| Voice and video for the same players and groups as that chat, or recording and livestreaming | Our Video SDK, on the same Stream app and user IDs as the chat |
Our Unity Chat SDK is the client for our version of that service. The full source of our Unity Chat SDK is on GitHub, so you and your engineers can see if it is the right solution for your in-game chat needs. It's C# and stateful, which means it keeps a local copy of the channels, messages, and users your player can see and updates that copy as events arrive over the WebSocket. You subscribe to plain C# events, MessageReceived, ReactionAdded, UserStartedTyping, PresenceChanged, and update your UI from them.
Other things you'd want to know:
- It builds for Android, iOS, WebGL, Windows, macOS, Linux, and consoles, and it works under IL2CPP.
- Channel types come with their permissions.
ChannelType.GamingandChannelType.Messagingare predefined, and you set up custom types in the dashboard. - The client pauses the WebSocket when the app goes to the background, recovers state when it returns, and a token provider fetches a new token from your backend when the old one expires.
- There are no UI components. A UGUI sample project ships with it, and you build the chat UI on the models.
Install it as a .unitypackage from the releases page and import it into the project.

Setting it up is one MonoBehaviour. CreateDefaultClient makes the client, ConnectUserAsync connects a user with the API key, their ID, and a token, GetOrCreateChannelWithIdAsync gets a channel by ID and creates it if it isn't there, and subscribing to MessageReceived is how you find out a message arrived:
using System.Threading.Tasks;
using StreamChat.Core;
using StreamChat.Core.Helpers;
using StreamChat.Core.StatefulModels;
using UnityEngine;
public class ChatManager : MonoBehaviour
{
private IStreamChatClient _chatClient;
private IStreamChannel _mainChannel;
private void Start()
{
_chatClient = StreamChatClient.CreateDefaultClient();
StartChatAsync().LogExceptionsOnFailed();
}
private async Task StartChatAsync()
{
// In production the token comes from your backend, signed with your API secret
var localUserData = await _chatClient.ConnectUserAsync("YOUR_API_KEY", "USER_ID", "USER_TOKEN");
Debug.Log($"User {localUserData.User.Id} is now connected!");
// Channel with "main" ID. In a game this ID is your grouping: a clan, a party, a match
_mainChannel = await _chatClient.GetOrCreateChannelWithIdAsync(ChannelType.Messaging, "main");
_mainChannel.MessageReceived += OnMessageReceived;
}
private void OnMessageReceived(IStreamChannel channel, IStreamMessage message)
{
Debug.Log($"Message {message.Text} was sent by {message.User.Id} to {channel.Id} channel");
}
}In a game, the channel ID is the group, a guild, a party, or a match. For a DM, GetOrCreateChannelWithMembersAsync takes the users instead and returns the same channel for the same set of people every time, so you never have to store a DM's ID yourself.

In a running game, the chat client is a second connection, next to the one your netcode holds to the host. Gameplay traffic goes to the host over Relay or a direct connection. Chat goes from each client to Stream over its own WebSocket, and your backend does two things: signs the user token and, through a server-side SDK, sets up channel types, permissions, and webhooks.

The host never sees a chat message, so a match ending, a host migrating, or a session server being recycled doesn't affect a channel or a DM.
For a full step-by-step build, see the Unity Chat Tutorial.
Adding Voice and Video With the Unity Video SDK
Our Unity Video SDK is a WebRTC client, built on Unity's WebRTC package, with the forwarding servers on our side in our edge network. It supports audio rooms, voice and video calls, and livestreaming.
Setting it up is the same sequence as chat:
StreamVideoClient.CreateDefaultClient()makes the client, andConnectUserAsyncconnects a user with the API key, user ID, and token.JoinCallAsyncjoins a call by type and ID, creating it if you ask it to.IStreamCall.Participantsis who's in the call, andParticipantJoinedandParticipantLeftfire as that changes.- Each participant has tracks. You give each
StreamAudioTrackanAudioSourceand eachStreamVideoTrackaRawImage.
The SDK hands you the tracks instead of playing them. So you can decide in your game where each voice should go and how loud it is. Turning one player down or muting them is a change to their AudioSource.
In the Stream SDK, a voice room is a call, and every call has an ID that you choose. If you want one room per party, use the party's ID as the call ID. For one room per match, use the match ID. A player joins the call for whatever they're in and leaves it when they move on.
Every call also has a type, and the type is where the permissions live. You set types up in the dashboard. For a party, you'd make a type where everyone can talk. There's a built-in audio room type where people join as listeners and the host decides who gets to speak.
Inviting a friend works through ringing. When a player creates a party room, they can add the friends they want as members and ring the call; each friend gets an incoming-call notification they can accept or decline. The Audio Rooms tutorial builds an audio room step by step, with join and leave buttons, a microphone picker, and a panel for each person in the room.
Video uses the same client. You turn the camera on the same way you turn the mic on, and each participant's video is drawn into a RawImage. By default, the SDK pulls in video from only five participants at a time because each video stream adds decoding work for the client. If you want more, you turn them on one participant at a time. The Video Calling tutorial builds a call with a video tile for each person.
Moderation and Parental Controls
Game chat has a bad reputation. Properly deservedly so. Put a public channel in a game with no filtering, and it takes a single player to ruin it for everyone else.
So moderation has to be there from launch. With Stream, it works in four layers:
- You limit what a channel type allows, like no links, no attachments, slow mode, and moderator roles.
- You filter with blocklists, regular expressions, and rules for domains and email addresses.
- Players mute and flag each other, and moderators ban or shadow ban. In the Unity SDK, that's
user.MuteAsync(),message.FlagAsync(),channel.BanUserAsync(), andchannel.ShadowBanUserAsync(), and anything flagged goes to a review queue in the dashboard. - AI moderation reads text, images, video, and audio, with the policies set in the dashboard.
When a policy blocks a message, no message.new event goes out, so nobody in the channel even knows it was sent.
Parental controls use the same permissions. For younger players, give them a role that can post in a guild channel but can't DM a stranger, turn attachments and links off on their channel type, use a stricter blocklist, and keep voice off unless a parent turns it on. All of that is set up in the dashboard, not in code. The legal side, COPPA in the US and the app store rules, needs a proper look from whoever does compliance for you.
How you staff the review queue is a bigger conversation, and so is which tools to use for each layer.
Start With the Unity Chat Tutorial
The quickest way to see whether this fits your game is to add a channel to a scene and send a message from it. The Unity Chat Tutorial gets you from an empty project to sending and receiving messages, and a free account is enough to run it.
From there, depending on what you're adding next:
- For voice in parties or matches, the Audio Rooms tutorial builds a room you can join from two devices.
- For video in a lobby, the Video Calling tutorial builds a call with a tile per person.
- For everything the SDKs can do, the Unity Chat docs and Unity Video docs cover the full API, and the source is on GitHub for both chat and video.
If you're planning a launch with a large number of players online at once, talk to us before it happens, and we'll go through the numbers with you.
