[ad_1]
Our prompt was to do something related to a new game engine, and I’ve never worked in Unreal at all, so it seemed like a good choice. I did have a little bit of knowledge of C++, so I decided to follow the Blueprint approach, just to make the experience even more of a fresh start.
I decided on the more specific goal of making a functioning inventory system. I started out with some basic steps to make interactable items and pick them up (the bottom section isn’t really used anymore, but it’s what I started out with):
This was easier than I expected for never having touched this engine before. Next on the list was having some UI that I could toggle with a key press. I tried a couple different methods for this, but ended up with something like this (activated using Tab):
I used Unreal’s version of the Input Manager to do this, although it says that these specific inputs are deprecated, so this might need changed.
The hardest part was managing the inventory itself, and then updating the UI accordingly. I had never even made an array in blueprints until now, so it took a lot of tutorials and experimentation. Here’s how I pick up each item and add it to the inventory:
This is the Inventory component, which manages the array and calls the UI update:
The UI itself looks like this, and then I dynamically add a textbox to the vertical list upon pickup:
Here’s a quick look at the end result so far:
The list is preserved when you open/close the UI, and it updates properly regardless of if it’s open or closed. I also have a blueprint to de-activate movement when the inventory is open, but I haven’t enabled it yet.
Final Goals:
I would like to go in the direction of sorting. Having multiple buttons that would re-arrange the inventory in alphabetical, chronological, or some other order would be a fun way to experiment with other sorts of variable interactions within blueprints. Adding delete functionality and some more polish (like images) would also be a nice touch.
[ad_2]
Source link