Built-in text chat for multiplayer games. Messages are routed through the host, validated, filtered, and displayed via the standard overlay UI - no game code required.
The API lives in the Sandbox.Platform namespace.
Chat can be configured in Project Settings > Platform:
Chat.Say( string message )Send a chat message to the server. The host validates and broadcasts it to all connected players.
Chat.Say( "Hello everyone!" );
Chat.AddText( string message )Add a local-only notification to the chat feed. Not networked.
Chat.AddText( $"{player.Name} joined the game" );
Messages are automatically sanitized, rate-limited, and passed through Steam's text filter. Blocked users are filtered out on the receiving end.
Implement IChatEvent on a component to intercept, modify, suppress, or filter messages. This event fires in two places:
RecipientFilter.public class TeamChat : Component, IChatEvent
{
public void OnChatMessage( ChatMessageEvent e )
{
if ( !e.Message.StartsWith( "/team" ) )
return;
// Strip the command prefix
e.Message = e.Message["/team ".Length..];
// Only deliver to players on the same team
var senderTeam = GetTeam( e.Sender );
e.RecipientFilter = connection => GetTeam( connection ) == senderTeam;
}
}
ChatMessageEvent| Property | Type | Description |
|---|---|---|
Message |
string |
The message text (mutable) |
Sender |
Connection |
Who sent it (null for system messages) |
Suppress |
bool |
Set true to prevent delivery |
RecipientFilter |
Func<Connection, bool> |
Per-connection visibility (host only) |