-
Notifications
You must be signed in to change notification settings - Fork 0
3.1 A simple Dialog Widget
This guide will walk you through creating a standard Dialog Widget (UI) that can display text, speaker names, avatars, and handle player input.
| Action | Details |
![]() |
1. Right-click in your Content Browser.
|
For the Dialog System to communicate with your new Widget (e.g., to tell it "Here is the text to show"), you must implement the BDC Interface.
- Open your Widget and switch to the Graph View (top right corner).
- Click on Class Settings in the toolbar.
- In the Details Panel, look for Implemented Interfaces.
- Click Add and search for:
BDC_DialogBackend_InterfaceUI.
Once added, you will see a new category in your Interfaces list (My Blueprint panel) containing events like OnDialogUpdated and OnDialogStarted.
Go to the Designer View. A basic Dialog Widget typically needs the following elements:
| Element | Recommended UMG Type | Description |
| The Message | RichTextBlock |
Displays the actual dialog text. Using RichText is highly recommended to support effects like <shake> or colors. |
| Speaker Name | RichTextBlock |
Displays the name of the character talking. |
| Avatar | Image |
Displays the texture/portrait of the speaker. |
| Options Container |
VerticalBox or ScrollBox
|
A container where you will spawn buttons when the player needs to make a choice. |
| Continue Button | Button |
A large invisible button covering the text area (or the whole screen) to let players click to "Next". |
Back in the Graph View, double-click the Interface functions in the "My Blueprint" panel to implement them.
When it fires: Immediately when the dialog begins.
What to do:
- Play an "Open" animation (Fade In).
- Set the Input Mode to UI Only (if you want to block character movement).
- Clear any dummy text from your Designer view.
When it fires: Every time the dialog advances to a new node. This is the heart of your widget.
What to do:
The event provides a CurrentData struct. Break this struct to access:
- SpeakerName: Set your Speaker Name TextBlock.
- Message: Set your Message RichTextBlock.
- AvatarImage: Set your Avatar Image brush.
-
MessageSound: Play this sound (using
PlaySound2D).
Handling Options:
Inside OnDialogUpdated, use the function GetAvailableOptions (from BDC Library). If it returns true:
1. Hide the "Continue Button".
2. Loop through the options array and create a button for each one in your Options Container.
If it returns false, ensure your "Continue Button" is visible and focused.
When it fires: When the conversation ends.
What to do:
- Play a "Close" animation.
- Call
RemoveFromParent(or set Visibility to Collapsed). - Restore Input Mode to Game Only.
On your "Continue Button" OnClicked event, verify if options are currently displayed. If no options are visible, call the function:
BDC_Dialog_Library::InjectContinue
This signals the subsystem to advance to the next node manually.
On your dynamically created Option Buttons, when clicked, call:
BDC_Dialog_Library::SelectOption(Index)
Pass the index of the option (0 for the first button, 1 for the second, etc.).
I. What is the Dialog Backend?
II. Setting up
|
