
I decided to create a designer friendly inventory system as i've seen a lot of people at university struggle with certain aspects of blueprint, including UMG. I thought this would be a nice easy set of blueprints that could be moved into any project and set up easily by anybody.
Its free to download and use. Please credit me where you can though! You can change anything about it, its mostly a base for anyone who needs a basic inventory system.
The Basics
There are quite a few blueprint classes that come with this system, but most of them you wont be touching yourself.
Inventory.uasset = The UMG for the inventory.
InventorySlot.uasset = A slot for the inventory that is used in the overall inventory UMG.
InventorySystem.uasset = The Component you add to your character you wish to have an inventory.
InventStruct.uasset = Struct that is used on the PickUp component to set the details of the Pickup.
PickUpComponent.uasset = The Pickup component you add to an item you want to pick up.
How to use it
Its a very simple process, follow these steps or download the zip which includes a step by step guide with images, including functions you can call and varaibles you can edit.
1 - Add an InventorySystem component to your myCharacter blueprint.
2 - Set up an input in the myCharacter blueprint to call PickUpItem from the InventorySystem, I suggest left click.
Any Item you want to be picked up:
MAKE SURE IT HAS COLLISION
1- Add a PickUpComponent to the item.
2 - Find the drop down for Item Info and fill in the image you want to show in the inventory slot, the name of the item and add a reference to the item itself.
Thats it! Everything should work by itself from there onwards!
Functions / Variables
There are some functions and varaibles you can access from outside the classes.
There is a reference to the HUD in the inventorysystem attached to the player called HUD. From that reference you can access:
Functions:
DropAllInventory – This drops all of your current inventory using the dropAllTransform as its starting point for the first object then adding the offsetDrop to spawn the rest of the objects so they do not spawn within each other.
ResetInventory – This resets your entire inventory and DOES NOT drop any item. If there are items in your inventory when you call this, they will be deleted not dropped.
Variables:
dropAllTransform – This is the starting point transform where the items are dropped by default.
spawnOffset – This is the offset from the player that the object should be spawned at, to stop items spawning in the player.
offsetDrop – This is the offset from the last dropped object when dropping all items from your inventory using the function DropAllInventory.



Default Inventory

AddItemToInventory Function

Included Blueprints

Inventory with some items and hovered over text showing

Placed items down again so inventory empty

DropAllInventory Function

Add a pickup component in the details panels and add to the Item Info section to add details

How each slot press works for inventory

How to add the inventory component in your my character blueprint

How to call the pick up function in the my character blueprint

PickUpItem Function

SetSlotsAndInventory at the beginning of the game


BLUEPRINTS



