Skip to content

DialogueBox

Inherits: PanelContainer < Container < Control < CanvasItem < Entity < Object

A box that shows one line of dialogue with the choices under it.

The Dialogue message step of a graph script puts one of these on the stage. It shows who speaks, the line, and one button for each choice. With no choices it shows one Continue button.

To use your own box, make a prefab whose root has a show_message() method and a finished signal. Wire the prefab to the step’s prefab input, or set the graph_script/dialogue/prefab project setting to use it for every message. This class is the box the step makes when neither is set.

Type Name Default
float anchor_bottom 1.0 (overrides Control)
float anchor_left 0.5 (overrides Control)
float anchor_right 0.5 (overrides Control)
float anchor_top 1.0 (overrides Control)
Vector2 custom_minimum_size Vector2(480, 0) (overrides Control)
Control.GrowDirection grow_horizontal 2 (overrides Control)
Control.GrowDirection grow_vertical 0 (overrides Control)
Returns Method
void choose(index: int)
PackedStringArray get_choices() const
String get_speaker() const
String get_text() const
void show_message(speaker: String, text: String, choices: PackedStringArray)

finished

finished(index: int)

Emitted when a button is pressed. index is the number of the choice, counted from zero, or -1 for Continue.

choose

void choose(index: int)

Emits finished with index. Choices count from zero. Pass -1 for Continue. The step that put the box on the stage removes it.

get_choices

PackedStringArray get_choices() const

Returns the text of each choice on show, in the order they appear.

get_speaker

String get_speaker() const

Returns who speaks the line on show.

get_text

String get_text() const

Returns the line on show.

show_message

void show_message(speaker: String, text: String, choices: PackedStringArray)

Shows text said by speaker, with one button for each entry of choices. A box that shows a message again replaces the buttons it had.