ChatMessageLine

UI component that renders a single chat message. Wraps a TextMeshProUGUI component and displays a ChatMessage using its ToString() representation. Used by the chat scroll rect to populate the message display area.

Definition

Namespace: Paragon.Townskeep.ChatSystem.HUD Assembly: Townskeep.dll

public class ChatMessageLine : ParagonUIBehaviour

Inheritance: SerializedMonoBehaviourParagonBehaviourParagonUIBehaviour → ChatMessageLine

Remarks

ChatMessageLine is a lightweight display component — it holds a reference to a ChatMessage and renders it via TextMeshProUGUI. The HEIGHT constant defines the fixed height of each line element, used by the scroll rect for layout calculations.

The LineCount property returns the number of visible lines as configured on the TextMeshProUGUI component (via maxVisibleLines), which is useful for calculating the total scroll area needed.

Quick Lookup

Goal
How

Display a message

messageLine.SetMessage(chatMessage)

Clear the display

messageLine.ClearMessage()

Get line height

ChatMessageLine.HEIGHT (constant: 20f)

Get visible line count

messageLine.LineCount

Properties

LineCount

The maximum number of visible text lines in the TextMeshProUGUI component. Returns text.maxVisibleLines.

Methods

SetMessage

Displays a chat message. Stores the message reference and sets the text component to message.ToString().

Parameter
Type
Description

message

ChatMessage

The message to display

ClearMessage

Resets the line to an empty state. Sets the stored message to ChatMessage.Empty and clears the text component.

Constants

HEIGHT

The fixed height (in pixels) of a single message line element. Used by the scroll rect for layout calculations.

Component Requirements

The ChatMessageLine GameObject must have a TextMeshProUGUI component on it (not on a child — GetComponent is used, not GetComponentInChildren).

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

Last updated