INVENTORY SYSTEM PROTOTYPE

Simple, scalable inventory system prototype heavily inspired by Subnautica. I made it in preparation for 3 game prototypes that I want to carry out and that would each use a slightly different inventory system. It was important to me to provide a smooth, intuitive experience with this system, and to be able to switch seamlessly between controller and keyboard/mouse.
It features:
Interaction system
Supports item stacking
3 types of auto-sorting
Storages
Dropping items (with specific quantity prompt if needed)
Full controller support
Assets used:


Development - Technical Design
MADE WITH UNREAL ENGINE 5
DEVELOPMENT & TECHNICAL DESIGN
General structure
For item data, I'm using a data table containing the following information:
Name
Type (enum)
Description
IsStackable (boolean)
MaxStackSize (if stackable)
Thumbnail reference
Class reference (used when spawning an item; must extend the BP_Item class)
I also have a F_InventoryItem struct used for each instance of an item (on the actor itself, or on a storage/inventory slot). The struct contains a data table row handle (referencing an entry in the data table) and a quantity.
BP_ThirdPersonCharacter
I made a BPI_Interactable interface for all actors that can be interacted with, with 2 functions to be implemented: Interact and ShowPrompt. All interactables should have a trigger collider that covers the distance from which the player can interact with them.
The character blueprint keeps track of which interactable actors it's overlapping with by storing their reference in an array.
Blueprint: Event Graph - Interaction System
Every time the character or the camera is moved, the following function is called. It is used to determine which of the nearby interactables should be prioritized when the player executes the "Interact" action, based on whether or not the actor is on screen, and which actor the character is facing the most.
BP_StorageComponent
Component attached to any actor that has storage (including the player character's inventory). It offers functionalities common to any storage, such as displaying the storage, adding and removing items, stacking items (if applicable; determined per item) and auto-sorting items (if applicable).
Blueprint functions to add/remove items from storage:
Additional blueprints:
BP_InventoryComponent
Subclass of BP_StorageComponent, it builds upon it with behavior specific to the player's inventory. Attached to BP_ThirdPersonCharacter.
Blueprints:
WBP_Inventory
The widget used for the player's inventory and all storages. It contains 2 wrap-boxes that can contain inventory slots. The wrap-box to be used is determined by the component (BP_StorageComponent or BP_InventoryComponent) that creates the widget.
Dev options are included for more specific behavior that can vary from one game to another.
Blueprints:
WBP_Slot
Widget for an inventory/storage slot, it contains a lot of the logic for the system, namely 2 types of possible actions: a "submit" action (keyboard/mouse: left-click; controller: face button down (Xbox A)) and a "special" action (keyboard/mouse: right-click; controller: face button left (Xbox X)).
When only in the inventory, the "submit" action executes the item's functionality depending on its type (uses consumable items, equips equipments, etc.). The "special" action drops the item.
When a storage is open, the "submit" action transfers the item from one storage/inventory to the other, and the "special" action is disabled (with the possibility of a future implementation).
Blueprint functions for these actions:
On controller, an item is always selected. On keyboard/mouse, no item is selected. The input type can be switched seamlessly from one to the other.
Additional blueprints:
WBP_ItemInfoPanel
Widget for the panel displaying item info. On controller, the panel appears underneath the selected item's slot. On keyboard/mouse, it follows the mouse and appears only when it hovers over an item slot.
Blueprint function to load the item's info: LoadItemInfo
WBP_DropConfirmation
Widget for the drop confirmation window (dev option can be ticked in the inventory). The window pops up whenever the player attempts to drop a stackable item that has more than one unit, allowing to specify a valid quantity to drop.
Additional blueprints: