The inventory system provides a several classes for constructing saveable inventories and inventory items. The system is fairly generic providing baseline functionality while requiring the designer to build the organization and presentation of the inventories tailored to their game.
Inventories are essentially an array of InventoryItems with built-in functionality for management, save and load, and filtering what items are allowed. The InventoryComponent provides a premade component that can be attached to any actor you want to add an Inventory to. You can also manually create an Inventory instead of the component if you want.
Each InventoryItem in an Inventory is an instance of its class. This means that each item slot holds a reference to an InventoryItem runtime object and each instance of an item holds its own stack count within a slot. Items should be thought of in two ways, immutable and mutable. Immutable items are meant to all be the same, meaning the only thing that matters is their stack count within an inventory. The stack count can be set per InventoryItem class. Mutable items are meant to be modifiable at runtime. This means that each instance could have unique stats and typically these don't stack, so the stack count is limited to 1 for the class. The inventory system does not enforce any limitations based on if an item is defined as Immutable or Mutable.
To create a new item, create a new Blueprint that inherits from the InventoryItem class. You can then configure and extend with functionality needed for your item. As long as you are inheriting from the InventoryItem class, the structure of how you build your items from there is left completely up to you.
This inventory system handles tracking items for you, but it is up to you to decide how the inventory is presented and interactable for the player. This means that the functions provided are intentionally basic and fundamental with some taking an input and returning output for you to handle.
It's also worth noting that Inventories are responsible for saving and loading the InventoryItems they hold. This means for each inventory slot, the inventory will save data it needs about each item. It is also responsible for calling save functionality on the item. When an inventory is loaded, it will reinstantiate a new instance for each item in its save data and reapply identification data to the item. It then calls load on the item so the item can now load its own data.
Inventories are responsible for tracking the runtime instances of InventoryItems.They implement save and load functionality and are also respnsible for managing items they contain. When an Inventory is loaded, it will also load any items it saved.
InventoryComponents provide an easy way to configure and instantiate an Inventory by attaching one to an actor. The InventoryComponent then essentially becomes the bridge for interaction between the actor and an Inventory. It is also possible to manually create, initialize, and manage an Inventory, but the InventoryComponent is made to simplify the process where it's available.
An InventoryItem is a base class that provides integration with Inventories and save/load functionality. This class is meant to be inherited from and extended to create items.
The InventoryManagerSubsystem is mainly responsible for owning and managing the player's Inventory. Player Inventories are set in Project Settings > Plugins > KGameFramework Settings > Player Inventories.
ItemActions are used to define what actions should be presented when an InventoryItem is selected.
An ItemActionGroup is simply a set of ItemActions that are grouped together for convenience and reusability.
An ItemActor is meant to be the game world representation of an InventoryItem that can be instantiated and interact with the game world.
ItemTags are used for comparison to determine what InventoryItems can be added to an Inventory.