Chat

UI subsystem for the in-game chat interface. ChatHUD is a HUDElement that coordinates a chat window, tabbed channel navigation, input field, and message display. The subsystem handles focus/unfocus states with animated fade transitions and integrates with the Chat singleton for message sending and channel management.

Architecture

spinner

Data Flow

spinner

Key Concepts

Concept
Description

ChatHUD

HUDElement subclass coordinating the entire chat UI. Manages focus state and fade transitions.

ChatInput

Text input field wrapper. Handles message submission to the Chat singleton and field activation.

ChatMessageLine

Individual line renderer. Wraps a TextMeshProUGUI component to display a single ChatMessage.

ChatWindow

Message display area. Binds to a ChatChannel and forwards new messages to the scroll rect.

ChatTabs

Tab bar for switching between chat channels. Creates tabs from Chat.GetChannels().

Focus/Unfocus

The chat has two visual states: focused (input active, fully visible) and unfocused (input hidden, fades out after 2s delay).

Quick Start

1. Access the chat from game code

2. Listen for focus changes

3. Hierarchy setup

Classes

Class
Description

Root chat element — focus management and fade transitions

Text input field — message submission and field activation

Single message line renderer

See Also

Last updated