Interaction Panels ​
An interaction panel is the window that belongs to an interaction. When the player talks to an NPC, opens a chest, trades, crafts or reads a sign, the interaction does its work and asks the interface to show the window for it. The windows live in the InteractionPanels container of the in-game scene.
Every interaction panel is a PanelUI (the DiceRoll panel is a small exception, it is part of the conversation).
The panels of the template ​
| Panel | Class | Opened by | What it shows |
|---|---|---|---|
| Conversation | ConversationPanelUI | The Conversation interaction | The speaker, the text (typed out), the responses, voice lines; skill checks open the dice roll |
| Dice roll | DiceRollPanel | A conversation response that has a check | The roll of a skill check and its result |
| Vendor | VendorPanelUI | The Vendor interaction | The shop's stock on one side and the player's bag on the other (right-click an item to sell it); a repair button |
| Trainer | TrainerPanelUI | The Trainer interaction | The lessons a trainer teaches, with their price. Made in code, there is no scene node for it |
| Crafting | CraftingPanelUI | The Crafting interaction | The recipes of a school, the materials, the queue and the progress |
| External inventory | InventoryUI (as External inventory) | A Container, a Loot interaction (a body), and Gather with the loot window | The contents of a chest, a body or a gathering node. Drag items out, or right-click to take them |
| Readable | ReadablePanelUI | A readable object or item (a book, a sign, a letter) | Pages, with next and previous, and a background |
| Socket | SocketPanelUI | Shift + right-click on equipment that has sockets | The sockets of the item, to put gems in and take them out |
How a window is opened ​
An interaction never touches the scene. It asks the UI manager, which hands the request to the current in-game scene if that scene has the method:
text
a Vendor interaction ─ ui_manager.open_vendor_panel(vendor, player) ─► InGameUI.open_vendor_panel ─► the window opensThe window then manages itself: it gets what it needs from the interaction (the vendor's stock, the conversation) and tells the interface when it closes, which also ends the interaction. Because a missing method is ignored, a game that does not use crafting can delete the crafting window and everything else still works.
An interaction panel is a normal window: opening it closes the others, and Esc closes it.
Adding your own interaction and window ​
Today this is manual
The template's windows are looked up by name in the scene and opened by methods of InGameUI. A window you add to InteractionPanels is not found automatically. Making this automatic (any panel placed in the container is registered and an interaction opens it by name) is not done yet; the Show UI Panel interaction already opens any panel placed in UIPanels by its name.
To add a window for an interaction of your own today:
- The window. Make a scene whose root script extends
PanelUI(title bar, close button, drag, and the tooltip, message and sound signals come with it). Add it as a child ofInteractionPanels. - The in-game class. Write
class_name MyInGameUI extends InGameUI, put it on the root of your in-game scene and set that scene in UI Settings. In it:- get your window (
@onready var my_panel: MyPanelUI = %MyPanelUI, unique name on the node), - add it to
all_window_interfacesinsetup_window_interfaces(callsuper, then append it), so it takes part in opening, closing andEsc, - write
open_my_panel(...), which sets the window up and callsopen_window(my_panel).
- get your window (
- The interaction. Write a class that extends
Interaction, and instart_interactioncallsystem_hub.ui_manager.current_ui.open_my_panel(...). Inend_interactionclose the window (close_window).
The new interaction type shows up in the interaction list of the editor by itself: interactions are found by scanning their folder.
Which interaction panel is which ​
The Show UI Panel interaction (Common interactions) opens one of the UI panels of the interface from an object or an NPC: see Interaction types. It is the easy way to open a panel of your own from the world, without writing an interaction class.
See also ​
- Interactables (what each interaction does)
- In Game
- UI Panels (the windows the player opens themselves)
- Tooltips