Skip to content
Plugin 1.0 · Unreal Engine 5.8Version details

Inventory UI and input ​

Guide in preparation

Verified Blueprint steps, screenshots, and graphs will be added here.

Before you start ​

Follow Set up an inventory in Blueprints. This walkthrough uses the demo's UI component, AC_ProjectOneUIComponent, on BP_DemoController, with inventory components on BP_DemoPlayerState.

The supplied UI component creates the inventory root widget. You can display this root directly or embed that same instance in your game's root widget, as the demo controller does. The demo uses UI Only input while the inventory is open; closing is handled by the widget. Container widgets bind to the player's inventory through Assign to Container Tag, as described below.

1. Create the inventory root widget ​

The UI component's Event Begin Play follows this sequence:

  1. Call Get Player Controller and check its return value with Is Valid.
  2. Call Is Local Controller on that controller and use its Boolean result as the Branch condition.
  3. From True, call Create WBP Inventory Root Widget.
  4. Connect Self (the UI component) to Inventory UIComponent on the create node.
  5. Save the created widget's Return Value in Root Widget.
  6. Pass Root Widget to Add to Viewport.
  7. Call Drag Drop Bindings, then Context Menu Bindings, with Self as their target.

The invalid-controller and non-local-controller paths do not create a widget. UI creation is gated by the local controller check, separately from the server authority check used to initialize inventory contents.

UI component Begin Play checks the controller, creates WBP Inventory Root Widget with Self as Inventory UIComponent, stores Root Widget, adds it to the viewport, and calls the binding functions

The shown graph leaves Owning Player on the create node unconnected. When adapting the graph to multiple local players, explicitly supply the intended owning Player Controller and verify that controller lookup selects that player.

The binding calls appear after root creation. Their internal graphs are not shown here and will be documented separately.

2. Embed the inventory in your game's widget ​

The second graph is in BP_DemoController. It shows how to put the existing inventory root inside a custom game root rather than creating another inventory widget.

Create the game root ​

  1. Call Create WBP Game Root Widget.
  2. Store its Return Value in Game Root Widget.
  3. Check Game Root Widget with Is Valid.
  4. From Is Valid, call Add to Viewport on Game Root Widget.

Add the interaction overlay ​

Next, call Create WBP Interaction Screen Widget and pass its return value to Content on Add Child, targeting Game Root Widget. This adds the demo's interaction overlay to the game root.

Add the inventory root when it is ready ​

Get Root Widget from AC Project One UIComponent using the validated GET shown in the graph:

  • From Is Valid, call Add Child on Game Root Widget, with the inventory Root Widget connected to Content.
  • From Is Not Valid, call Delay with Duration = 0.2, then retry the validated GET.

The retry allows the controller graph to wait until the UI component has created its root widget. The screenshot's execution wire enters from outside the frame, so it does not establish which controller event starts this sequence.

BP_DemoController creates a game root, adds the interaction screen, then waits for the UI component's Root Widget and adds it as a child

The Add Child node shown here targets WBP Game Root. If you use your own root widget, provide a way to insert the inventory widget into its layout, such as an appropriate panel or your own Add Child function. Reuse the component's Root Widget reference so the UI component continues to address the displayed inventory instance.

The demo first adds the inventory root to the viewport in the UI component, then inserts that instance into the game root in the controller. These are two stages of the supplied setup, not two independently created inventory roots.

3. Add container widgets to your inventory layout ​

Add the supplied container widgets to your inventory layout and set Assign to Container Tag on each widget instance. The widget uses this tag to find the corresponding container and bind to it automatically. Leave IsObserved disabled for the player's own inventory; enable it (true) to bind to observed containers.

Create the runtime containers through the inventory manager as described in Set up an inventory. The widget's assignment tag identifies the container to display; it must match that container's tag.

WBP_InventorySlotGrid: grid inventory ​

Use WBP_InventorySlotGrid to display a grid container. Item placement respects the container's shape and available cells. A grid can have a single cell, but an item whose shape requires more cells will not fit.

For a complete 4×4 example, see Display the example container, including the widget's State settings and the runtime result.

Configure the visual cell size in DA_InventoryUIConfig. Open the asset and set Configuration > Slot Size. The supplied example uses Slot Size = 70.0.

DA_InventoryUIConfig Configuration section with Slot Size set to 70.0

Changing Slot Size changes the displayed cell size. It does not change the container's cell count or an item's shape; configure those separately in their definitions.

WBP_EquipmentSlot: single-item equipment ​

Use WBP_EquipmentSlot for a Single Item container. It holds an item without requiring its shape to fit a grid, so an item can occupy this slot regardless of its shape. Other container filters still determine which items are allowed.

You can configure the widget's size and the name displayed above it. Set Assign to Container Tag to the tag of the single-item container it should display.

The supplied example shows:

  • Shape: 120.0 × 120.0.
  • Assign to Container Tag: Ric.Equipment.Headset.
  • Name: Headset.
  • Is Observed: unchecked, selecting the player's own inventory.

Equipment slot Designer preview and Details showing Shape 120 by 120, Ric.Equipment.Headset, Name Headset, and Is Observed disabled

WBP_EquipmentWithSlots: equipment with nested storage ​

WBP_EquipmentWithSlots works like WBP_EquipmentSlot, but also displays the equipped item's containers to its right. Use it for equipment with storage, such as the demo's chest rig or backpack.

The item definition must provide the nested storage as well as its UI layout:

  • Add a Container Collection fragment (recommended) and assign a collection asset containing an array of container definitions.
  • Alternatively, add a Container Definition fragment referencing a single container definition.
  • In both cases, also add BP_ItemFragment_ContainerArranger. It is required for this widget's nested-container layout even when the item has only one container.

The storage fragment supplies the containers; the arranger supplies their display positions. Adding the arranger alone does not give the item storage.

See Nested containers for the demo ChestRig's collection and fragment settings.

Configure the nested-container layout on the item definition through BP_ItemFragment_ContainerArranger:

  1. Add or configure BP_ItemFragment_ContainerArranger on the item.
  2. In ContainerLocations, set an Int Point position for each contained container.
  3. Array Index 0 positions the first container, Index 1 positions the second, and so on.

Each Int Point specifies (row, column) in the layout grid: X is the row and Y is the column. These are positions of the displayed containers, not item positions within a container. For a single container, configure Index 0 with its layout position, such as (0, 0).

The tactical chest rig example has both Container Collection and BP Item Fragment Container Arranger in its fragment list. Its eight Container Locations entries are (0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), and (1, 3), placing four single-cell compartments above four two-cell compartments. See the result in the UI.

Item definition with Container Collection and BP Item Fragment Container Arranger, showing eight Container Locations entries

Set Assign to Container Tag on WBP_EquipmentWithSlots to the equipment container's tag. The widget binds to that equipment container and displays nested storage supplied by the item placed in it.

Bind each widget by container tag ​

For each container widget in your layout:

  1. Choose the widget that matches the runtime container: WBP_InventorySlotGrid for a grid, or an equipment widget for Single Item.
  2. Select the widget instance and set Assign to Container Tag to the intended container's tag.
  3. Choose the inventory source with IsObserved: leave it disabled for the player's inventory, or enable it for observed containers.
  4. Ensure that the selected inventory source contains a container with the assignment tag.
  5. Run the level and open the inventory to check the binding.

With IsObserved = false, the widget looks up the container in the player's inventory. With IsObserved = true, it binds to the matching observed container instead. Set both the source flag and the assignment tag for widgets that display an inspected inventory.

In the demo, the inventory components live on BP_DemoPlayerState; they do not have to be attached directly to BP_DemoCharacter to follow this setup.

The root widget's Inventory UIComponent reference is supplied when it is created, as shown above. Keep that connection when using the supplied root.

4. Open the inventory from player input ​

The demo opens the inventory from either the keyboard or a gamepad:

  • Keyboard B: use Pressed.
  • Gamepad Face Button Top: use Pressed.

Connect both execution outputs to Show Inventory. Call Get Inventory UIComponent and connect its UIComponent output to the Target pin. Leave Show checked (true). The Released outputs are not used in this example.

Keyboard B and Gamepad Face Button Top Pressed events call Show Inventory with Show enabled and the target supplied by Get Inventory UIComponent

Opening the inventory sets the input mode to UI Only. The input-mode change is part of the UI opening behavior, rather than a separate node in this screenshot.

This graph requests opening; it is not a toggle. The inventory widget handles closing while the inventory is open. Do not rely on this controller input graph to receive the close key in UI Only mode.

The widget handles close input as described below. Closing restores Game Only input. Use Show Inventory to request these transitions.

5. Implement drag and drop ​

Instructions and screenshots will be added here.

6. Close the inventory from the widget ​

Open WBP_InventoryRoot, located in Content > RocketInventory > Inventory > UI > Root:

text
/Game/RocketInventory/Inventory/UI/Root/WBP_InventoryRoot

WBP_InventoryRoot selected in Content/RocketInventory/Inventory/UI/Root

The widget overrides OnPreviewKeyDown to handle closing while the input mode is UI Only. Its graph follows this sequence:

  1. Pass In Key Event to Get Key.
  2. Compare the returned key against B, Gamepad Face Button Top, and Gamepad Face Button Right.
  3. Combine the three comparisons with OR and pass the result to Branch.
  4. From True, call Show Inventory on the widget's Inventory UIComponent reference with Show unchecked (false).
  5. Return Handled after the close call.
  6. From False, return Unhandled, allowing other keys to continue through UI input processing.

WBP_InventoryRoot OnPreviewKeyDown checks B and the top and right gamepad face buttons, calls Show Inventory with Show disabled, and returns Handled or Unhandled

Closing through Show Inventory(false) restores the input mode to Game Only. The mode change occurs inside the close behavior; it is not a separate node in this key-handler screenshot.

The controller's B and top face-button events open the inventory. Once it is open, the widget receives the close input. Use Show Inventory for this flow rather than only removing or hiding a widget, so the UI component also performs its input-mode transition.

The full internal Show Inventory graph is not needed to follow this integration. This guide covers its opening and closing calls and input modes; it does not prescribe internal focus, cursor, or cleanup implementation.

Expected result ​

The populated example shows single-item equipment slots, nested chest rig and backpack storage, and an item assigned to a quick-use slot.

Inventory UI with equipment, populated nested containers, and an assigned quick-use slot

The example includes additional items beyond the setup guide's starting knife, chest rig, and backpack. Your displayed contents depend on the items you add.

Follow the Play mode checks to verify tag binding, placement, quick-slot assignment, and return to gameplay after closing.