Home

Awesome

Hotbar and Inventory System

Inventory System

This is a drag-and-drop inventory system for Unreal Engine 5, the following features are currently implemented:

Installation

  1. Download and install Git client https://git-scm.com
  2. Download and install Git LFS https://git-lfs.com
  3. Run this command in the terminal: git lfs install
  4. Clone the repo.

Usage

This project is a standard Third Person Template, all the Inventory relative files are available in the InventorySystem folder under Content. To test Item Pickups, I've added the BPI_PickupItems interface and Pickup Item event implementation to BP_ThirdPersonCharacter as follows:

<img src="images/PickupItemsEvent.png">

To use the system, do the following:

  1. Add your item types to the E_ItemType enum (InventorySystem/Enums).

  2. Update the DT_PickupItems data table (InventorySystem/DataTables) with your items:

    • Icon filed type is a texture2d. You can use the tool Icon Generator to create the icon.
    • Model field type is a static mesh.
    • Quantity field can be ignored here. It can be set when the PickupItem actor is added to the level.
    • Stackable field. How to handle the item, either individually or as a bulk.
    • MaxStack field. There is no stack limit if this field is set to zero, otherwise, the stack limit will be enforced.
    • AddToHotbar field. Where to add the item, if set to False, the item will be added to the Inventory instead.
  3. Select Hotbar or Inventory component in BP_CorePlayerController blueprint ((InventorySystem/Blueprints) to configure it:

    Hotbar options:

    <img src="images/HotbarOptions.png">
    • Keep the Hotbar array empty, it will be populated automatically during gameplay.
    • Total Items. How many Hotbar items to show (max: 10 items).
    • Move to Inventory when Full. Picked-up items will be added to the Inventory if Hotbar is full.

    Inventory options:

    <img src="images/InventoryOptions.png">
    • Keep the Inventory array empty, it will be populated automatically during gameplay.
    • Total Items. How many Inventory items to show?

    Global Inventory options:

    <img src="images/GlobalInventoryOptions.png">
    • ShowItemQuantity. Show or hide quantity.
    • ShowItemTooltip. Show or hide the tooltip.
  4. Add BP_ItemPickup (InventorySystem/Collectables) to the level and set the item and quantity.

Additional details:

Todos

Credits

Item models were downloaded from https://opengameart.org