UI Action System

Introduction
By default, certain native widgets in CommonUI, such as buttons, permit the assignment of a default input Action to bind inputs to the control. If you wish to introduce additional inputs, this can only be achieved through extension and binding at the C++ level.
In contrast, GUIS offers the UIAction system, which empowers you to dynamically manage widget input bindings in a data-driven, modular manner, seamlessly integrated with game logic.
When you select different types of Items, various UIActions are dynamically registered and showup in the bottom action bar.
The DestroyAction will prompt a confirmation popup.
The UIAction system comprises the following key components:
- GUIS_UIActionWidget: Integrated into any of your
CommonUserWidgets
for configuration purposes. - GUIS_UIActionFactory: A data asset that configures a set of potentially available UIActions.
- GUIS_UIAction: A class you can inherit via Blueprint or C++ to create diverse UI operations, encapsulating input handling logic.
No more dirty code inside your widget blueprint.
UIActionWidget
Illustrated below is a ListEntryWidget
that incorporates a UIActionWidget
, configured with an associated ActionFactory
.

ListEntryWidget has no visual.
When the data object (ListItemObject
) represented by the EntryWidget
is assigned, it becomes linked to the UIActionWidget
.
The data object can be any UObject, referring here to the UI-level representation of an item within an inventory system.
Upon the EntryWidget
being selected or deselected, the functions RegisterActions
and UnregisterActions
are invoked respectively to dynamically bind UI inputs.
UIActionFactory
The GUIS_UIActionFactory
is a data asset that allows you to configure a list of potential UIActions. This asset dynamically selects compatible UIActions based on the input data object provided by the user and binds the inputs accordingly.

This is an example of a UIActionFactory tailored for inventory items, where typical operations for an item might include destroying, equipping, or unequipping.
By default, a UIAction can define its display name on the UI, ID, input binding data, and whether a confirmation popup is required. You can further customize by subclassing GUIS_UIAction
to include additional fields as needed.
UIAction
Inherit from GUIS_UIAction
to craft new UIActions.

Override the IsCompatible
method to determine whether the incoming data object is compatible with the Action. Only compatible Actions will be selected by the Factory and have their UI inputs registered.
Additionally, you can override CanInvoke
and InvokeAction
to encapsulate the actual game logic of the Action.
For instance, the logic for an Action such as "Destroy Item" is detailed as follows: