UI Action System

The UIAction system, which empowers you to dynamically manage widget input bindings in a data-driven, modular manner, seamlessly integrated with game logic.

Cover.GGS
罗传月武(YueWu)

Author

罗传月武(YueWu)

专注游戏开发和Web技术。

Created: Jun 03, 2025Updated: Sep 15, 2026

Table of contents

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 CommonUserWidgetsfor 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.

Nice

No more dirty code inside your widget blueprint.

UIActionWidget

Illustrated below is a ListEntryWidgetthat incorporates a UIActionWidget, configured with an associated ActionFactory.

通用UI系统.UIAction.Widget

ListEntryWidget has no visual.

When the data object (ListItemObject) represented by the EntryWidgetis assigned, it becomes linked to the UIActionWidget.

Loading Blueprint

Initializing BlueprintUE renderer...

DataObject

The data object can be any UObject, referring here to the UI-level representation of an item within an inventory system.

Upon the EntryWidgetbeing selected or deselected, the functions RegisterActionsand UnregisterActionsare invoked respectively to dynamically bind UI inputs.

Loading Blueprint

Initializing BlueprintUE renderer...

UIActionFactory

The GUIS_UIActionFactoryis 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.

通用UI系统.UIAction.Factory

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_UIActionto include additional fields as needed.

UIAction

Inherit from GUIS_UIActionto craft new UIActions.

通用UI系统.UIAction.Custom

Override the IsCompatiblemethod 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:

Loading Blueprint

Initializing BlueprintUE renderer...

Loading Blueprint

Initializing BlueprintUE renderer...